summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_browsertest.cc
diff options
context:
space:
mode:
authorjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-19 05:29:14 +0000
committerjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-19 05:29:14 +0000
commiteb3895186d79897fc17310cae771ce2d8df32066 (patch)
treec6423387ba3366c7503db22c4450e280e0d0375a /chrome/browser/browser_browsertest.cc
parentd6abb667e3ef8fcdf3a01e287e01bb3729b77f18 (diff)
downloadchromium_src-eb3895186d79897fc17310cae771ce2d8df32066.zip
chromium_src-eb3895186d79897fc17310cae771ce2d8df32066.tar.gz
chromium_src-eb3895186d79897fc17310cae771ce2d8df32066.tar.bz2
Attempt at fixing flakyness of the browser test:
BrowserTest.PageLanguageDetection. BUG=40962 TEST=The test should not be flaky anymore. Review URL: http://codereview.chromium.org/1642002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_browsertest.cc')
-rw-r--r--chrome/browser/browser_browsertest.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc
index cc6883c..4a60ef4 100644
--- a/chrome/browser/browser_browsertest.cc
+++ b/chrome/browser/browser_browsertest.cc
@@ -455,8 +455,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, AppTabRemovedWhenExtensionUninstalled) {
#endif // !defined(OS_MACOSX)
// Tests that the CLD (Compact Language Detection) works properly.
-// Crashy, http://crbug.com/40962.
-IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_PageLanguageDetection) {
+IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) {
static const wchar_t kDocRoot[] = L"chrome/test/data";
scoped_refptr<HTTPTestServer> server(
HTTPTestServer::CreateServer(kDocRoot, NULL));
@@ -465,18 +464,30 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_PageLanguageDetection) {
TabContents* current_tab = browser()->GetSelectedTabContents();
// Navigate to a page in English.
+ ui_test_utils::WindowedNotificationObserverWithDetails<TabContents,
+ std::string>
+ en_language_detected_signal(NotificationType::TAB_LANGUAGE_DETERMINED,
+ current_tab);
ui_test_utils::NavigateToURL(
browser(), GURL(server->TestServerPage("files/english_page.html")));
EXPECT_TRUE(current_tab->language_state().original_language().empty());
- std::string lang = ui_test_utils::WaitForLanguageDetection(current_tab);
+ en_language_detected_signal.Wait();
+ std::string lang;
+ EXPECT_TRUE(en_language_detected_signal.GetDetailsFor(current_tab, &lang));
EXPECT_EQ("en", lang);
EXPECT_EQ("en", current_tab->language_state().original_language());
// Now navigate to a page in French.
+ ui_test_utils::WindowedNotificationObserverWithDetails<TabContents,
+ std::string>
+ fr_language_detected_signal(NotificationType::TAB_LANGUAGE_DETERMINED,
+ current_tab);
ui_test_utils::NavigateToURL(
browser(), GURL(server->TestServerPage("files/french_page.html")));
EXPECT_TRUE(current_tab->language_state().original_language().empty());
- lang = ui_test_utils::WaitForLanguageDetection(current_tab);
+ fr_language_detected_signal.Wait();
+ lang.clear();
+ EXPECT_TRUE(fr_language_detected_signal.GetDetailsFor(current_tab, &lang));
EXPECT_EQ("fr", lang);
EXPECT_EQ("fr", current_tab->language_state().original_language());
}