Commit cb0a29d1 authored by Mark Cogan's avatar Mark Cogan Committed by Commit Bot

[iOS] Make net:test_support dependencies in egtests explicit.

ChromeTestCase exposes an EmbeddedTestServer property for use by tests,
and includes the header for that class in its own header. This means
that tests can (and do) use symbols from EmbeddedTestServer without
explicitly including them. To make this work, //net:test_support is
a public dependency of the egtest test_support targets, so the individual
egtest targets can link correctly.

This is in general not in line with our "include what you use" policy,
which would prefer that code which uses symbols from an API directly
includes the header for that API, and explicitly declares it as a dep
in gn.

This CL:

  - Makes the test_support dependencies on //net:test_support private.
  - Changes the EmbeddedTestServer header include in chrome_test_case.h
    to be a forward declaration.
  - Updates nineteen egtest.mm files to explicitly include the
    EmbeddedTestServer header.
  - Updates twenty-seven targets in BUILD.gn files to have add a
    //net:test_support as a dependency.


Change-Id: Iea336c66a1a7423732e3aaedcf865882b7ac3a0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1892814
Commit-Queue: Mark Cogan <marq@chromium.org>
Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712100}
parent 18762bfd
......@@ -30,6 +30,7 @@ source_set("eg_tests") {
"//ios/web/public/js_messaging",
"//ios/web/public/test:element_selector",
"//ios/web/public/test/http_server:http_server",
"//net:test_support",
]
libs = [ "XCTest.framework" ]
}
......
......@@ -24,6 +24,7 @@ source_set("eg_tests") {
"//ios/web/public",
"//ios/web/public/test:element_selector",
"//ios/web/public/test/http_server",
"//net:test_support",
"//url",
]
libs = [
......
......@@ -26,6 +26,7 @@
#include "ios/web/public/test/element_selector.h"
#import "ios/web/public/ui/crw_web_view_proxy.h"
#import "ios/web/public/web_state.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "url/gurl.h"
......
......@@ -49,6 +49,7 @@ source_set("eg_tests") {
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//net:test_support",
"//ui/base",
"//url",
]
......
......@@ -225,6 +225,7 @@ source_set("eg_tests") {
"//ios/web/public/test",
"//ios/web/public/test:element_selector",
"//ios/web/public/test/http_server",
"//net:test_support",
"//ui/base",
"//url",
]
......@@ -249,6 +250,7 @@ source_set("test_support") {
"//ios/chrome/test:eg_test_support",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//net:test_support",
"//ui/base",
]
configs += [ "//build/config/compiler:enable_arc" ]
......
......@@ -220,6 +220,7 @@ source_set("eg_tests") {
"//ios/chrome/test/earl_grey:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/web/public/test/http_server",
"//net:test_support",
]
libs = [
"UIKit.framework",
......@@ -246,6 +247,7 @@ source_set("eg2_tests") {
"//ios/testing/earl_grey:eg_test_support+eg2",
"//ios/third_party/earl_grey2:test_lib",
"//ios/web/public/test/http_server",
"//net:test_support",
]
libs = [ "UIKit.framework" ]
}
......
......@@ -24,6 +24,7 @@
#import "ios/testing/earl_grey/earl_grey_test.h"
#import "ios/web/public/test/http_server/http_server.h"
#include "ios/web/public/test/http_server/http_server_util.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......
......@@ -73,6 +73,7 @@ source_set("eg_tests") {
"//ios/chrome/test/earl_grey:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/web/public/test/http_server",
"//net:test_support",
]
libs = [
"UIKit.framework",
......
......@@ -12,6 +12,7 @@
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
......
......@@ -162,6 +162,7 @@ source_set("eg_test_support") {
deps = [
":authentication",
"unified_consent",
"//base/test:test_support",
"//components/signin/public/identity_manager",
"//ios/chrome/app/strings:ios_strings_grit",
"//ios/chrome/browser/browser_state",
......
......@@ -162,7 +162,9 @@ source_set("eg_tests") {
"//ios/testing/earl_grey:earl_grey_support",
"//ios/web/public/js_messaging",
"//ios/web/public/test/http_server",
"//net:test_support",
"//services/network:test_support",
"//testing/gtest:gtest",
]
libs = [
"UIKit.framework",
......
......@@ -225,6 +225,7 @@ source_set("eg_tests") {
"//ios/web:earl_grey_test_support",
"//ios/web/public/test:element_selector",
"//ios/web/public/test/http_server",
"//net:test_support",
]
}
......
......@@ -13,6 +13,7 @@
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/chrome/test/scoped_eg_synchronization_disabler.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......
......@@ -311,6 +311,7 @@ source_set("eg_tests") {
"//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link",
"//ios/web/public/test/http_server",
"//net:test_support",
"//testing/gmock",
"//ui/strings",
]
......
......@@ -22,6 +22,7 @@
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#import "net/base/mac/url_conversions.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "ui/strings/grit/ui_strings.h"
......
......@@ -17,6 +17,7 @@
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/chrome/test/scoped_eg_synchronization_disabler.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "ui/base/l10n/l10n_util.h"
......
......@@ -153,6 +153,7 @@ source_set("eg_tests") {
"//ios/web/public/test",
"//ios/web/public/test:element_selector",
"//ios/web/public/test/http_server",
"//net:test_support",
"//ui/base",
"//url",
]
......
......@@ -134,6 +134,7 @@ source_set("eg_tests") {
"//ios/web:earl_grey_test_support",
"//ios/web/public",
"//ios/web/public/test:element_selector",
"//net:test_support",
"//ui/base",
]
libs = [ "XCTest.framework" ]
......
......@@ -12,6 +12,7 @@
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "net/http/http_status_code.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "ui/base/l10n/l10n_util_mac.h"
......
......@@ -14,6 +14,7 @@
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "ui/base/l10n/l10n_util_mac.h"
......
......@@ -174,6 +174,7 @@ source_set("eg_tests") {
"//ios/web/public/test",
"//ios/web/public/test/http_server",
"//net",
"//net:test_support",
"//ui/base",
]
libs = [
......
......@@ -16,6 +16,7 @@ source_set("eg2_tests") {
"//ios/chrome/test/earl_grey:eg_test_support+eg2",
"//ios/testing/earl_grey:eg_test_support+eg2",
"//ios/third_party/earl_grey2:test_lib",
"//net:test_support",
"//ui/base",
]
libs = [
......
......@@ -10,6 +10,7 @@
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......
......@@ -207,6 +207,7 @@ source_set("eg_tests") {
"//ios/testing:hardware_keyboarr_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link",
"//net:test_support",
"//testing/gmock",
"//ui/base",
]
......
......@@ -17,6 +17,7 @@
#import "ios/chrome/test/earl_grey/chrome_matchers_app_interface.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/hardware_keyboard_util.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "ui/base/l10n/l10n_util.h"
......
......@@ -174,6 +174,7 @@ source_set("eg_tests") {
"//ios/chrome/test/earl_grey:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link",
"//net:test_support",
"//testing/gmock",
]
libs = [ "XCTest.framework" ]
......
......@@ -13,6 +13,7 @@
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
......
......@@ -15,6 +15,7 @@
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
......
......@@ -13,6 +13,7 @@
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "ui/base/l10n/l10n_util_mac.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
......
......@@ -315,6 +315,7 @@ source_set("eg_tests") {
"//ios/third_party/material_components_ios",
"//ios/web/public/test",
"//ios/web/public/test/http_server",
"//net:test_support",
"//testing/gtest",
"//third_party/libaddressinput:strings_grit",
"//ui/base",
......
......@@ -201,6 +201,7 @@ source_set("eg_tests") {
"//ios/web/public/test",
"//ios/web/public/test/http_server",
"//net",
"//net:test_support",
]
libs = [
"UIKit.framework",
......
......@@ -127,6 +127,7 @@ source_set("eg_tests") {
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//net:test_support",
"//ui/base",
]
}
......
......@@ -100,6 +100,7 @@ source_set("eg_tests") {
"//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//net:test_support",
"//ui/strings:ui_strings_grit",
]
}
......@@ -88,6 +88,7 @@ source_set("eg_tests") {
"//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link",
"//ios/web/public/test/http_server",
"//net:test_support",
]
libs = [ "XCTest.framework" ]
}
......
......@@ -157,6 +157,7 @@ source_set("eg_tests") {
"//ios/chrome/test/earl_grey:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/web/public/test/http_server",
"//net:test_support",
]
libs = [ "UIKit.framework" ]
}
......
......@@ -261,6 +261,7 @@ source_set("eg_tests") {
"//ios/web:earl_grey_test_support",
"//ios/web/public/test:element_selector",
"//ios/web/public/test/http_server",
"//net:test_support",
"//ui/base",
]
libs = [ "XCTest.framework" ]
......
......@@ -18,6 +18,7 @@
#import "ios/testing/earl_grey/disabled_test_macros.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "ios/web/public/test/element_selector.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "ui/base/l10n/l10n_util_mac.h"
......
......@@ -137,6 +137,7 @@ source_set("eg_tests") {
"//ios/chrome/test/earl_grey:test_support",
"//ios/web",
"//ios/web/public/test:element_selector",
"//net:test_support",
"//ui/base",
"//url",
]
......
......@@ -14,6 +14,7 @@
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#include "ios/web/public/test/element_selector.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......
......@@ -19,6 +19,7 @@
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/web/public/web_client.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "ui/base/device_form_factor.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/scheme_host_port.h"
......
......@@ -11,6 +11,7 @@
#import "ios/testing/earl_grey/earl_grey_test.h"
#import "ios/web/public/test/http_server/http_server.h"
#include "ios/web/public/test/http_server/http_server_util.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
......
......@@ -9,6 +9,7 @@
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#include "ios/net/url_test_util.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "ui/base/l10n/l10n_util.h"
......
......@@ -10,6 +10,7 @@
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#import "ios/web/public/test/element_selector.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......
......@@ -293,6 +293,7 @@ source_set("test_support") {
"//ios/web/public/deprecated",
"//ios/web/public/test:element_selector",
"//ios/web/public/test/http_server",
"//net:test_support",
"//services/metrics/public/cpp:metrics_cpp",
"//ui/base",
"//ui/base:test_support",
......@@ -306,7 +307,6 @@ source_set("test_support") {
"//ios/third_party/gtx:gtx+link",
"//ios/web/public/test",
"//ios/web/public/test/fakes",
"//net:test_support",
]
libs = [
......@@ -487,11 +487,8 @@ source_set("eg_test_support+eg2") {
"//ios/third_party/gtx:gtx+link",
"//ios/web/public/test:element_selector",
"//ios/web/public/test/http_server",
"//net:test_support",
"//ui/base",
"//url",
]
public_deps = [
"//net:test_support",
]
}
......@@ -10,7 +10,12 @@
#import "base/ios/block_types.h"
#import "ios/testing/earl_grey/base_earl_grey_test_case.h"
#import "ios/testing/earl_grey/disabled_test_macros.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
namespace net {
namespace test_server {
class EmbeddedTestServer;
}
}
// Base class for all Chrome Earl Grey tests.
@interface ChromeTestCase : BaseEarlGreyTestCase
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment