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

Side by Side Diff: chrome/browser/translate/translate_manager_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: Make some of the harness factory methods private Created 6 years, 1 month 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 "components/translate/core/browser/translate_manager.h" 5 #include "components/translate/core/browser/translate_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/prefs/session_startup_pref.h" 9 #include "chrome/browser/prefs/session_startup_pref.h"
10 #include "chrome/browser/translate/chrome_translate_client.h" 10 #include "chrome/browser/translate/chrome_translate_client.h"
11 #include "chrome/browser/translate/cld_data_harness.h" 11 #include "chrome/browser/translate/cld_data_harness.h"
12 #include "chrome/browser/translate/cld_data_harness_factory.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
15 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
16 #include "components/translate/core/common/language_detection_details.h" 17 #include "components/translate/core/common/language_detection_details.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 class TranslateManagerBrowserTest : public InProcessBrowserTest {}; 20 class TranslateManagerBrowserTest : public InProcessBrowserTest {};
20 21
21 // Test is flaky on Win http://crbug.com/166334 22 // Test is flaky on Win http://crbug.com/166334
22 #if defined(OS_WIN) 23 #if defined(OS_WIN)
23 #define MAYBE_PRE_TranslateSessionRestore DISABLED_PRE_TranslateSessionRestore 24 #define MAYBE_PRE_TranslateSessionRestore DISABLED_PRE_TranslateSessionRestore
24 #else 25 #else
25 #define MAYBE_PRE_TranslateSessionRestore PRE_TranslateSessionRestore 26 #define MAYBE_PRE_TranslateSessionRestore PRE_TranslateSessionRestore
26 #endif 27 #endif
27 // Test that session restore restores the translate infobar and other translate 28 // Test that session restore restores the translate infobar and other translate
28 // settings. 29 // settings.
29 IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, 30 IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest,
30 MAYBE_PRE_TranslateSessionRestore) { 31 MAYBE_PRE_TranslateSessionRestore) {
31 scoped_ptr<test::CldDataHarness> cld_data_harness = 32 scoped_ptr<test::CldDataHarness> cld_data_harness =
32 test::CreateCldDataHarness(); 33 test::CldDataHarnessFactory::Get()->CreateCldDataHarness();
33 ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init()); 34 ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init());
34 SessionStartupPref pref(SessionStartupPref::LAST); 35 SessionStartupPref pref(SessionStartupPref::LAST);
35 SessionStartupPref::SetStartupPref(browser()->profile(), pref); 36 SessionStartupPref::SetStartupPref(browser()->profile(), pref);
36 37
37 content::WebContents* current_web_contents = 38 content::WebContents* current_web_contents =
38 browser()->tab_strip_model()->GetActiveWebContents(); 39 browser()->tab_strip_model()->GetActiveWebContents();
39 ChromeTranslateClient* chrome_translate_client = 40 ChromeTranslateClient* chrome_translate_client =
40 ChromeTranslateClient::FromWebContents(current_web_contents); 41 ChromeTranslateClient::FromWebContents(current_web_contents);
41 content::Source<content::WebContents> source(current_web_contents); 42 content::Source<content::WebContents> source(current_web_contents);
42 43
(...skipping 15 matching lines...) Expand all
58 } 59 }
59 60
60 #if defined (OS_WIN) 61 #if defined (OS_WIN)
61 #define MAYBE_TranslateSessionRestore DISABLED_TranslateSessionRestore 62 #define MAYBE_TranslateSessionRestore DISABLED_TranslateSessionRestore
62 #else 63 #else
63 #define MAYBE_TranslateSessionRestore TranslateSessionRestore 64 #define MAYBE_TranslateSessionRestore TranslateSessionRestore
64 #endif 65 #endif
65 IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, 66 IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest,
66 MAYBE_TranslateSessionRestore) { 67 MAYBE_TranslateSessionRestore) {
67 scoped_ptr<test::CldDataHarness> cld_data_harness = 68 scoped_ptr<test::CldDataHarness> cld_data_harness =
68 test::CreateCldDataHarness(); 69 test::CldDataHarnessFactory::Get()->CreateCldDataHarness();
69 ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init()); 70 ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init());
70 content::WebContents* current_web_contents = 71 content::WebContents* current_web_contents =
71 browser()->tab_strip_model()->GetActiveWebContents(); 72 browser()->tab_strip_model()->GetActiveWebContents();
72 content::Source<content::WebContents> source(current_web_contents); 73 content::Source<content::WebContents> source(current_web_contents);
73 74
74 ui_test_utils::WindowedNotificationObserverWithDetails< 75 ui_test_utils::WindowedNotificationObserverWithDetails<
75 translate::LanguageDetectionDetails> 76 translate::LanguageDetectionDetails>
76 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, 77 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
77 source); 78 source);
78 fr_language_detected_signal.Wait(); 79 fr_language_detected_signal.Wait();
79 } 80 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/static_cld_data_harness.cc ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698