OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
10 #include "chrome/browser/app_modal_dialog.h" | 10 #include "chrome/browser/app_modal_dialog.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 ASSERT_TRUE(NULL != server.get()); | 281 ASSERT_TRUE(NULL != server.get()); |
282 GURL url(server->TestServerPage("files/onload_redirect_to_anchor.html")); | 282 GURL url(server->TestServerPage("files/onload_redirect_to_anchor.html")); |
283 GURL expected_favicon_url(server->TestServerPage("files/test.png")); | 283 GURL expected_favicon_url(server->TestServerPage("files/test.png")); |
284 | 284 |
285 ui_test_utils::NavigateToURL(browser(), url); | 285 ui_test_utils::NavigateToURL(browser(), url); |
286 | 286 |
287 NavigationEntry* entry = browser()->GetSelectedTabContents()-> | 287 NavigationEntry* entry = browser()->GetSelectedTabContents()-> |
288 controller().GetActiveEntry(); | 288 controller().GetActiveEntry(); |
289 EXPECT_EQ(expected_favicon_url.spec(), entry->favicon().url().spec()); | 289 EXPECT_EQ(expected_favicon_url.spec(), entry->favicon().url().spec()); |
290 } | 290 } |
| 291 |
| 292 // The CLD library only works on Windows at this point. |
| 293 #if defined(OS_WIN) |
| 294 // Tests that the CLD (Compact Language Detection) works properly. |
| 295 IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) { |
| 296 static const wchar_t kDocRoot[] = L"chrome/test/data"; |
| 297 scoped_refptr<HTTPTestServer> server( |
| 298 HTTPTestServer::CreateServer(kDocRoot, NULL)); |
| 299 ASSERT_TRUE(NULL != server.get()); |
| 300 |
| 301 TabContents* current_tab = browser()->GetSelectedTabContents(); |
| 302 |
| 303 // Navigate to a page in English. |
| 304 ui_test_utils::NavigateToURL( |
| 305 browser(), GURL(server->TestServerPage("files/english_page.html"))); |
| 306 NavigationEntry* entry = current_tab->controller().GetActiveEntry(); |
| 307 ASSERT_TRUE(NULL != entry); |
| 308 EXPECT_TRUE(entry->language().empty()); |
| 309 std::string lang = ui_test_utils::WaitForLanguageDetection(current_tab); |
| 310 EXPECT_EQ("en", lang); |
| 311 EXPECT_EQ("en", entry->language()); |
| 312 |
| 313 // Now navigate to a page in French. |
| 314 ui_test_utils::NavigateToURL( |
| 315 browser(), GURL(server->TestServerPage("files/french_page.html"))); |
| 316 entry = current_tab->controller().GetActiveEntry(); |
| 317 ASSERT_TRUE(NULL != entry); |
| 318 EXPECT_TRUE(entry->language().empty()); |
| 319 lang = ui_test_utils::WaitForLanguageDetection(current_tab); |
| 320 EXPECT_EQ("fr", lang); |
| 321 EXPECT_EQ("fr", entry->language()); |
| 322 } |
| 323 #endif |
OLD | NEW |