Commit 1ae00048 authored by John Z Wu's avatar John Z Wu Committed by Commit Bot

Attempt to deflake testLanguageDetectionHttpContentLanguageBehindLink.

It should probably wait until the page finishes loading before selecting
the new url in the omnibox.

Bug: 893843
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I1546b567755a6878cf0d3239a77f3485f05cb6b1
Reviewed-on: https://chromium-review.googlesource.com/c/1278813Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: John Wu <jzw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599647}
parent 891c6bf8
...@@ -100,6 +100,9 @@ const char kFrenchPageWithLinkPath[] = "/frenchpagewithlink/"; ...@@ -100,6 +100,9 @@ const char kFrenchPageWithLinkPath[] = "/frenchpagewithlink/";
const char kTranslateScriptPath[] = "/translatescript/"; const char kTranslateScriptPath[] = "/translatescript/";
const char kTranslateScript[] = "Fake Translate Script"; const char kTranslateScript[] = "Fake Translate Script";
// Body text for /languagepath/.
const char kLanguagePathText[] = "Some text here.";
// Builds a HTML document with a French text and the given |html| and |meta| // Builds a HTML document with a French text and the given |html| and |meta|
// tags. // tags.
std::string GetFrenchPageHtml(const std::string& html_tag, std::string GetFrenchPageHtml(const std::string& html_tag,
...@@ -230,7 +233,8 @@ void TestResponseProvider::GetLanguageResponse( ...@@ -230,7 +233,8 @@ void TestResponseProvider::GetLanguageResponse(
"'>" "'>"
"</head>"; "</head>";
} }
*response_body += "<body>Some text here.</body></html>"; *response_body +=
base::StringPrintf("<html><body>%s</body></html>", kLanguagePathText);
} }
} // namespace } // namespace
...@@ -502,9 +506,8 @@ using translate::LanguageDetectionController; ...@@ -502,9 +506,8 @@ using translate::LanguageDetectionController;
[self assertLanguageDetails:expectedLanguageDetails]; [self assertLanguageDetails:expectedLanguageDetails];
} }
// TODO(crbug.com/893843): This test is flaky.
// Tests that language in http content is detected when navigating to a link. // Tests that language in http content is detected when navigating to a link.
- (void)FLAKY_testLanguageDetectionHttpContentLanguageBehindLink { - (void)testLanguageDetectionHttpContentLanguageBehindLink {
// Start the HTTP server. // Start the HTTP server.
std::unique_ptr<web::DataResponseProvider> provider(new TestResponseProvider); std::unique_ptr<web::DataResponseProvider> provider(new TestResponseProvider);
web::test::SetUpHttpServer(std::move(provider)); web::test::SetUpHttpServer(std::move(provider));
...@@ -515,6 +518,7 @@ using translate::LanguageDetectionController; ...@@ -515,6 +518,7 @@ using translate::LanguageDetectionController;
GURL someLanguageURL = web::test::HttpServer::MakeUrl(kSomeLanguageUrl); GURL someLanguageURL = web::test::HttpServer::MakeUrl(kSomeLanguageUrl);
[ChromeEarlGrey loadURL:URL]; [ChromeEarlGrey loadURL:URL];
GREYAssert(TapWebViewElementWithId("click"), @"Failed to tap \"click\""); GREYAssert(TapWebViewElementWithId("click"), @"Failed to tap \"click\"");
[ChromeEarlGrey waitForWebViewContainingText:kLanguagePathText];
[[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText(
someLanguageURL.GetContent())] someLanguageURL.GetContent())]
assertWithMatcher:grey_notNil()]; assertWithMatcher:grey_notNil()];
......
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