Commit f2ac6241 authored by Nazerke's avatar Nazerke Committed by Commit Bot

[iOS][eg2] Convert prerender_egtest to EG2 target.

This CL adds a file to EG2 target and updates headers and adds eg2_test
source_set in build file.

Bug: 987646
Change-Id: Ia7e5b80e523d48d37b2552623529dc1e93fb0160
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1871693Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarRobbie Gibson <rkgibson@google.com>
Commit-Queue: Nazerke Kalidolda <nazerke@google.com>
Auto-Submit: Nazerke Kalidolda <nazerke@google.com>
Cr-Commit-Position: refs/heads/master@{#708951}
parent 2cb0d840
......@@ -63,18 +63,15 @@ source_set("unit_tests") {
]
}
source_set("eg_tests") {
defines = [ "CHROME_EARL_GREY_1" ]
testonly = true
sources = [
"prerender_egtest.mm",
]
deps = [
"//base",
"//ios/chrome/browser/ui/content_suggestions:content_suggestions_constant",
"//ios/chrome/browser/ui/omnibox:omnibox_internal",
"//ios/chrome/browser/ui/omnibox/popup:popup_ui",
"//ios/chrome/browser/ui/util",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/web/public/test/http_server",
]
libs = [
......@@ -83,3 +80,22 @@ source_set("eg_tests") {
]
configs += [ "//build/config/compiler:enable_arc" ]
}
source_set("eg2_tests") {
defines = [ "CHROME_EARL_GREY_2" ]
configs += [
"//build/config/compiler:enable_arc",
"//build/config/ios:xctest_config",
]
testonly = true
sources = [
"prerender_egtest.mm",
]
deps = [
"//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",
]
libs = [ "UIKit.framework" ]
}
......@@ -2,17 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <EarlGrey/EarlGrey.h>
#import <XCTest/XCTest.h>
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/strings/sys_string_conversions.h"
#import "base/test/ios/wait_util.h"
#import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h"
#import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h"
#import "ios/chrome/browser/ui/omnibox/popup/omnibox_popup_truncating_label.h"
#include "ios/chrome/browser/ui/util/ui_util.h"
#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"
......@@ -110,18 +106,17 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
// Make sure the omnibox is autocompleted.
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(pageString),
grey_ancestor(grey_kindOfClass(
[OmniboxTextFieldIOS class])),
grey_ancestor(grey_kindOfClassName(
@"OmniboxTextFieldIOS")),
nil)]
assertWithMatcher:grey_sufficientlyVisible()];
// Open the suggestion. The suggestion needs to be the first suggestion to
// have the prerenderer activated.
[[EarlGrey
selectElementWithMatcher:grey_allOf(
grey_accessibilityLabel(pageString),
grey_kindOfClass(
[OmniboxPopupTruncatingLabel class]),
selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(pageString),
grey_kindOfClassName(
@"OmniboxPopupTruncatingLabel"),
grey_ancestor(grey_accessibilityID(
@"omnibox suggestion 0")),
grey_sufficientlyVisible(), nil)]
......
......@@ -34,6 +34,7 @@ chrome_ios_eg2_test("ios_chrome_integration_eg2tests_module") {
deps = [
"//ios/chrome/browser/ntp_tiles:eg2_tests",
"//ios/chrome/browser/prerender:eg2_tests",
]
}
......
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