diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-16 01:30:48 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-16 01:30:48 +0000 |
commit | 214be467093e9455fb23dafb862cc1476daa5426 (patch) | |
tree | 352b4de0381c97720c64f52f17f376e39e885473 /chrome/browser/browser_browsertest.cc | |
parent | defda2819e4bc8311597273f5f98addd9d7a01c0 (diff) | |
download | chromium_src-214be467093e9455fb23dafb862cc1476daa5426.zip chromium_src-214be467093e9455fb23dafb862cc1476daa5426.tar.gz chromium_src-214be467093e9455fb23dafb862cc1476daa5426.tar.bz2 |
4th attempt at landing this.
It caused several tests to fails previously.
Cannot repro any of the failure. I am suspecting a clobber would have probably fixed it. (there is a change in one of the IPC messages that probably messed up the build somehow).
No code change.
Enabling language detection on page load.
A memory error has been fixed in the CLD library in the meantime.
This should hopefully fixes the crashers in the reliability tests.
Note that this version is actually simpler than the original review since the detection is now performed in the renderer. (So the CLD code runs sandboxed.)
Original review:
http://codereview.chromium.org/492024/show
BUG=30662
TEST=Run the unit-tests.
TBR=brettw
Review URL: http://codereview.chromium.org/548057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36442 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_browsertest.cc')
-rw-r--r-- | chrome/browser/browser_browsertest.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc index 756b7dc..a948947 100644 --- a/chrome/browser/browser_browsertest.cc +++ b/chrome/browser/browser_browsertest.cc @@ -288,3 +288,36 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, FaviconOfOnloadRedirectToAnchorPage) { controller().GetActiveEntry(); EXPECT_EQ(expected_favicon_url.spec(), entry->favicon().url().spec()); } + +// The CLD library only works on Windows at this point. +#if defined(OS_WIN) +// Tests that the CLD (Compact Language Detection) works properly. +IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) { + static const wchar_t kDocRoot[] = L"chrome/test/data"; + scoped_refptr<HTTPTestServer> server( + HTTPTestServer::CreateServer(kDocRoot, NULL)); + ASSERT_TRUE(NULL != server.get()); + + TabContents* current_tab = browser()->GetSelectedTabContents(); + + // Navigate to a page in English. + ui_test_utils::NavigateToURL( + browser(), GURL(server->TestServerPage("files/english_page.html"))); + NavigationEntry* entry = current_tab->controller().GetActiveEntry(); + ASSERT_TRUE(NULL != entry); + EXPECT_TRUE(entry->language().empty()); + std::string lang = ui_test_utils::WaitForLanguageDetection(current_tab); + EXPECT_EQ("en", lang); + EXPECT_EQ("en", entry->language()); + + // Now navigate to a page in French. + ui_test_utils::NavigateToURL( + browser(), GURL(server->TestServerPage("files/french_page.html"))); + entry = current_tab->controller().GetActiveEntry(); + ASSERT_TRUE(NULL != entry); + EXPECT_TRUE(entry->language().empty()); + lang = ui_test_utils::WaitForLanguageDetection(current_tab); + EXPECT_EQ("fr", lang); + EXPECT_EQ("fr", entry->language()); +} +#endif |