# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

source_set("dialogs") {
  deps = [
    "//base",
    "//ios/web",
  ]

  sources = [
    "java_script_dialog_blocking_state.h",
    "java_script_dialog_blocking_state.mm",
  ]

  configs += [ "//build/config/compiler:enable_arc" ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "java_script_dialog_blocking_state_unittest.mm",
  ]

  deps = [
    ":dialogs",
    "//ios/web",
    "//ios/web/public/test/fakes",
    "//testing/gtest",
  ]

  configs += [ "//build/config/compiler:enable_arc" ]
}

source_set("dialogs_internal") {
  configs += [ "//build/config/compiler:enable_arc" ]
  sources = [
    "dialog_presenter.h",
    "dialog_presenter.mm",
    "java_script_dialog_presenter_impl.h",
    "java_script_dialog_presenter_impl.mm",
    "nsurl_protection_space_util.h",
    "nsurl_protection_space_util.mm",
  ]
  deps = [
    ":dialogs",
    "//base",
    "//components/strings",
    "//components/url_formatter",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/ui",
    "//ios/chrome/browser/ui/alert_coordinator",
    "//ios/web",
    "//ui/base",
    "//url",
  ]
  libs = [ "UIKit.framework" ]
}

source_set("unit_tests_internal") {
  configs += [ "//build/config/compiler:enable_arc" ]
  testonly = true
  sources = [
    "dialog_presenter_unittest.mm",
    "java_script_dialog_presenter_impl_unittest.mm",
    "nsurl_protection_space_util_unittest.mm",
  ]
  deps = [
    ":dialogs_internal",
    "//base",
    "//components/strings",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/ui/alert_coordinator",
    "//ios/web",
    "//ios/web/public/test/fakes",
    "//testing/gtest",
    "//ui/base",
    "//url",
  ]
}

source_set("eg_tests") {
  configs += [ "//build/config/compiler:enable_arc" ]
  testonly = true
  sources = [
    "javascript_dialog_egtest.mm",
  ]
  deps = [
    ":dialogs_internal",
    "//base",
    "//base/test:test_support",
    "//components/strings",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/ui",
    "//ios/chrome/browser/ui/tools_menu/public",
    "//ios/chrome/test/app:test_support",
    "//ios/chrome/test/earl_grey:test_support",
    "//ios/testing/earl_grey:earl_grey_support",
    "//ios/third_party/earl_grey:earl_grey+link",
    "//ios/web",
    "//ios/web:earl_grey_test_support",
    "//ios/web/public/test",
    "//ios/web/public/test/http_server",
    "//ui/base",
    "//url",
  ]
  libs = [
    "UIKit.framework",
    "XCTest.framework",
  ]
}
