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

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

Issue 461633002: Refactor language detection logic to allow non-static CLD data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge error in chrome/browser/BUILD.gn Created 6 years, 2 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 | Annotate | Revision Log
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 14 matching lines...) Expand all
25 #include "chrome/browser/first_run/first_run.h" 25 #include "chrome/browser/first_run/first_run.h"
26 #include "chrome/browser/lifetime/application_lifetime.h" 26 #include "chrome/browser/lifetime/application_lifetime.h"
27 #include "chrome/browser/prefs/incognito_mode_prefs.h" 27 #include "chrome/browser/prefs/incognito_mode_prefs.h"
28 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/browser/profiles/profile_manager.h" 29 #include "chrome/browser/profiles/profile_manager.h"
30 #include "chrome/browser/search/search.h" 30 #include "chrome/browser/search/search.h"
31 #include "chrome/browser/sessions/session_backend.h" 31 #include "chrome/browser/sessions/session_backend.h"
32 #include "chrome/browser/sessions/session_service_factory.h" 32 #include "chrome/browser/sessions/session_service_factory.h"
33 #include "chrome/browser/translate/chrome_translate_client.h" 33 #include "chrome/browser/translate/chrome_translate_client.h"
34 #include "chrome/browser/translate/cld_data_harness.h" 34 #include "chrome/browser/translate/cld_data_harness.h"
35 #include "chrome/browser/translate/cld_data_harness_factory.h"
35 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" 36 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
36 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" 37 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h"
37 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" 38 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h"
38 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" 39 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
39 #include "chrome/browser/ui/browser.h" 40 #include "chrome/browser/ui/browser.h"
40 #include "chrome/browser/ui/browser_command_controller.h" 41 #include "chrome/browser/ui/browser_command_controller.h"
41 #include "chrome/browser/ui/browser_commands.h" 42 #include "chrome/browser/ui/browser_commands.h"
42 #include "chrome/browser/ui/browser_finder.h" 43 #include "chrome/browser/ui/browser_finder.h"
43 #include "chrome/browser/ui/browser_iterator.h" 44 #include "chrome/browser/ui/browser_iterator.h"
44 #include "chrome/browser/ui/browser_navigator.h" 45 #include "chrome/browser/ui/browser_navigator.h"
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 EXPECT_FALSE( 1378 EXPECT_FALSE(
1378 app_browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)); 1379 app_browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR));
1379 1380
1380 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window); 1381 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window);
1381 } 1382 }
1382 #endif 1383 #endif
1383 1384
1384 // Tests that the CLD (Compact Language Detection) works properly. 1385 // Tests that the CLD (Compact Language Detection) works properly.
1385 IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) { 1386 IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) {
1386 scoped_ptr<test::CldDataHarness> cld_data_harness = 1387 scoped_ptr<test::CldDataHarness> cld_data_harness =
1387 test::CreateCldDataHarness(); 1388 test::CldDataHarnessFactory::Get()->CreateCldDataHarness();
1388 ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init()); 1389 ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init());
1389 ASSERT_TRUE(test_server()->Start()); 1390 ASSERT_TRUE(test_server()->Start());
1390 1391
1391 translate::LanguageDetectionDetails details; 1392 translate::LanguageDetectionDetails details;
1392 1393
1393 // Open a new tab with a page in English. 1394 // Open a new tab with a page in English.
1394 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")), 1395 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")),
1395 ui::PAGE_TRANSITION_TYPED); 1396 ui::PAGE_TRANSITION_TYPED);
1396 1397
1397 WebContents* current_web_contents = 1398 WebContents* current_web_contents =
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 #endif 2647 #endif
2647 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2648 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2648 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2649 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2649 gfx::Size exp_final_size(initial_wcv_size); 2650 gfx::Size exp_final_size(initial_wcv_size);
2650 exp_final_size.Enlarge(wcv_resize_insets.width(), 2651 exp_final_size.Enlarge(wcv_resize_insets.width(),
2651 wcv_resize_insets.height() + height_inset); 2652 wcv_resize_insets.height() + height_inset);
2652 EXPECT_EQ(exp_final_size, 2653 EXPECT_EQ(exp_final_size,
2653 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2654 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2654 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); 2655 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size());
2655 } 2656 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698