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

Side by Side Diff: chrome/browser/translate/translate_manager_browsertest.cc

Issue 2034413003: Delete the non-static CLD data source logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to latest master Created 4 years, 6 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 "components/translate/core/browser/translate_manager.h" 5 #include "components/translate/core/browser/translate_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/prefs/session_startup_pref.h" 11 #include "chrome/browser/prefs/session_startup_pref.h"
12 #include "chrome/browser/translate/chrome_translate_client.h" 12 #include "chrome/browser/translate/chrome_translate_client.h"
13 #include "chrome/browser/translate/cld_data_harness.h"
14 #include "chrome/browser/translate/cld_data_harness_factory.h"
15 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
17 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
18 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
19 #include "components/translate/core/common/language_detection_details.h" 17 #include "components/translate/core/common/language_detection_details.h"
20 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
21 #include "url/gurl.h" 19 #include "url/gurl.h"
22 20
23 class TranslateManagerBrowserTest : public InProcessBrowserTest { 21 class TranslateManagerBrowserTest : public InProcessBrowserTest {
24 public: 22 public:
25 TranslateManagerBrowserTest() {} 23 TranslateManagerBrowserTest() {}
26 ~TranslateManagerBrowserTest() override {} 24 ~TranslateManagerBrowserTest() override {}
27 25
28 void WaitUntilLanguageDetected() { language_detected_signal_->Wait(); } 26 void WaitUntilLanguageDetected() { language_detected_signal_->Wait(); }
29 27
30 void ResetObserver() { 28 void ResetObserver() {
31 language_detected_signal_.reset(new LangageDetectionObserver( 29 language_detected_signal_.reset(new LangageDetectionObserver(
32 chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, 30 chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
33 content::NotificationService::AllSources())); 31 content::NotificationService::AllSources()));
34 } 32 }
35 33
36 protected: 34 protected:
37 // InProcessBrowserTest members. 35 // InProcessBrowserTest members.
38 void SetUp() override { 36 void SetUp() override {
39 std::unique_ptr<test::CldDataHarness> cld_data_harness =
40 test::CldDataHarnessFactory::Get()->CreateCldDataHarness();
41 ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init());
42 InProcessBrowserTest::SetUp(); 37 InProcessBrowserTest::SetUp();
43 } 38 }
44 void SetUpOnMainThread() override { 39 void SetUpOnMainThread() override {
45 ResetObserver(); 40 ResetObserver();
46 InProcessBrowserTest::SetUpOnMainThread(); 41 InProcessBrowserTest::SetUpOnMainThread();
47 } 42 }
48 43
49 private: 44 private:
50 using LangageDetectionObserver = 45 using LangageDetectionObserver =
51 ui_test_utils::WindowedNotificationObserverWithDetails< 46 ui_test_utils::WindowedNotificationObserverWithDetails<
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 ChromeTranslateClient::FromWebContents(restored_web_contents); 140 ChromeTranslateClient::FromWebContents(restored_web_contents);
146 if (restored_translate_client->GetLanguageState() 141 if (restored_translate_client->GetLanguageState()
147 .current_language() 142 .current_language()
148 .empty()) { 143 .empty()) {
149 ResetObserver(); 144 ResetObserver();
150 WaitUntilLanguageDetected(); 145 WaitUntilLanguageDetected();
151 } 146 }
152 EXPECT_EQ("fr", 147 EXPECT_EQ("fr",
153 restored_translate_client->GetLanguageState().current_language()); 148 restored_translate_client->GetLanguageState().current_language());
154 } 149 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/standalone_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