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

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: Create a factory for test harnesses and use it 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 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 EXPECT_FALSE( 1402 EXPECT_FALSE(
1402 app_browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)); 1403 app_browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR));
1403 1404
1404 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window); 1405 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window);
1405 } 1406 }
1406 #endif 1407 #endif
1407 1408
1408 // Tests that the CLD (Compact Language Detection) works properly. 1409 // Tests that the CLD (Compact Language Detection) works properly.
1409 IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) { 1410 IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) {
1410 scoped_ptr<test::CldDataHarness> cld_data_harness = 1411 scoped_ptr<test::CldDataHarness> cld_data_harness =
1411 test::CreateCldDataHarness(); 1412 test::CldDataHarnessFactory::Get()->CreateCldDataHarness();
1412 ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init()); 1413 ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init());
1413 ASSERT_TRUE(test_server()->Start()); 1414 ASSERT_TRUE(test_server()->Start());
1414 1415
1415 translate::LanguageDetectionDetails details; 1416 translate::LanguageDetectionDetails details;
1416 1417
1417 // Open a new tab with a page in English. 1418 // Open a new tab with a page in English.
1418 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")), 1419 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")),
1419 ui::PAGE_TRANSITION_TYPED); 1420 ui::PAGE_TRANSITION_TYPED);
1420 1421
1421 WebContents* current_web_contents = 1422 WebContents* current_web_contents =
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
2713 #endif 2714 #endif
2714 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2715 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2715 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2716 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2716 gfx::Size exp_final_size(initial_wcv_size); 2717 gfx::Size exp_final_size(initial_wcv_size);
2717 exp_final_size.Enlarge(wcv_resize_insets.width(), 2718 exp_final_size.Enlarge(wcv_resize_insets.width(),
2718 wcv_resize_insets.height() + height_inset); 2719 wcv_resize_insets.height() + height_inset);
2719 EXPECT_EQ(exp_final_size, 2720 EXPECT_EQ(exp_final_size,
2720 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2721 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2721 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); 2722 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size());
2722 } 2723 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698