Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: chrome/browser/ui/browser_browsertest.cc

Issue 378253002: Fix translate namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 } 1404 }
1405 #endif 1405 #endif
1406 1406
1407 // Tests that the CLD (Compact Language Detection) works properly. 1407 // Tests that the CLD (Compact Language Detection) works properly.
1408 IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) { 1408 IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) {
1409 scoped_ptr<test::CldDataHarness> cld_data_harness = 1409 scoped_ptr<test::CldDataHarness> cld_data_harness =
1410 test::CreateCldDataHarness(); 1410 test::CreateCldDataHarness();
1411 ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init()); 1411 ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init());
1412 ASSERT_TRUE(test_server()->Start()); 1412 ASSERT_TRUE(test_server()->Start());
1413 1413
1414 LanguageDetectionDetails details; 1414 translate::LanguageDetectionDetails details;
1415 1415
1416 // Open a new tab with a page in English. 1416 // Open a new tab with a page in English.
1417 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")), 1417 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")),
1418 content::PAGE_TRANSITION_TYPED); 1418 content::PAGE_TRANSITION_TYPED);
1419 1419
1420 WebContents* current_web_contents = 1420 WebContents* current_web_contents =
1421 browser()->tab_strip_model()->GetActiveWebContents(); 1421 browser()->tab_strip_model()->GetActiveWebContents();
1422 ChromeTranslateClient* chrome_translate_client = 1422 ChromeTranslateClient* chrome_translate_client =
1423 ChromeTranslateClient::FromWebContents(current_web_contents); 1423 ChromeTranslateClient::FromWebContents(current_web_contents);
1424 content::Source<WebContents> source(current_web_contents); 1424 content::Source<WebContents> source(current_web_contents);
1425 1425
1426 ui_test_utils::WindowedNotificationObserverWithDetails< 1426 ui_test_utils::WindowedNotificationObserverWithDetails<
1427 LanguageDetectionDetails> 1427 translate::LanguageDetectionDetails>
1428 en_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, 1428 en_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
1429 source); 1429 source);
1430 EXPECT_EQ("", 1430 EXPECT_EQ("",
1431 chrome_translate_client->GetLanguageState().original_language()); 1431 chrome_translate_client->GetLanguageState().original_language());
1432 en_language_detected_signal.Wait(); 1432 en_language_detected_signal.Wait();
1433 EXPECT_TRUE(en_language_detected_signal.GetDetailsFor( 1433 EXPECT_TRUE(en_language_detected_signal.GetDetailsFor(
1434 source.map_key(), &details)); 1434 source.map_key(), &details));
1435 EXPECT_EQ("en", details.adopted_language); 1435 EXPECT_EQ("en", details.adopted_language);
1436 EXPECT_EQ("en", 1436 EXPECT_EQ("en",
1437 chrome_translate_client->GetLanguageState().original_language()); 1437 chrome_translate_client->GetLanguageState().original_language());
1438 1438
1439 // Now navigate to a page in French. 1439 // Now navigate to a page in French.
1440 ui_test_utils::WindowedNotificationObserverWithDetails< 1440 ui_test_utils::WindowedNotificationObserverWithDetails<
1441 LanguageDetectionDetails> 1441 translate::LanguageDetectionDetails>
1442 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, 1442 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
1443 source); 1443 source);
1444 ui_test_utils::NavigateToURL( 1444 ui_test_utils::NavigateToURL(
1445 browser(), GURL(test_server()->GetURL("files/french_page.html"))); 1445 browser(), GURL(test_server()->GetURL("files/french_page.html")));
1446 fr_language_detected_signal.Wait(); 1446 fr_language_detected_signal.Wait();
1447 details.adopted_language.clear(); 1447 details.adopted_language.clear();
1448 EXPECT_TRUE(fr_language_detected_signal.GetDetailsFor( 1448 EXPECT_TRUE(fr_language_detected_signal.GetDetailsFor(
1449 source.map_key(), &details)); 1449 source.map_key(), &details));
1450 EXPECT_EQ("fr", details.adopted_language); 1450 EXPECT_EQ("fr", details.adopted_language);
1451 EXPECT_EQ("fr", 1451 EXPECT_EQ("fr",
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 #endif 2704 #endif
2705 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2705 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2706 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2706 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2707 gfx::Size exp_final_size(initial_wcv_size); 2707 gfx::Size exp_final_size(initial_wcv_size);
2708 exp_final_size.Enlarge(wcv_resize_insets.width(), 2708 exp_final_size.Enlarge(wcv_resize_insets.width(),
2709 wcv_resize_insets.height() + height_inset); 2709 wcv_resize_insets.height() + height_inset);
2710 EXPECT_EQ(exp_final_size, 2710 EXPECT_EQ(exp_final_size,
2711 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2711 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2712 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); 2712 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size());
2713 } 2713 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698