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

Side by Side Diff: chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc

Issue 2799883003: Switch from TestBrowserThread to TestBrowserThreadBundle in chrome. (Closed)
Patch Set: fix-string Created 3 years, 7 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 "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" 5 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/message_loop/message_loop.h"
16 #include "base/run_loop.h" 15 #include "base/run_loop.h"
17 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
18 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
19 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" 18 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h"
20 #include "chrome/browser/service_process/service_process_control.h" 19 #include "chrome/browser/service_process/service_process_control.h"
21 #include "chrome/browser/ui/startup/startup_browser_creator.h" 20 #include "chrome/browser/ui/startup/startup_browser_creator.h"
22 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/cloud_print/cloud_print_proxy_info.h" 22 #include "chrome/common/cloud_print/cloud_print_proxy_info.h"
24 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
25 #include "chrome/common/service_messages.h" 24 #include "chrome/common/service_messages.h"
26 #include "chrome/test/base/testing_browser_process.h" 25 #include "chrome/test/base/testing_browser_process.h"
27 #include "chrome/test/base/testing_profile.h" 26 #include "chrome/test/base/testing_profile.h"
28 #include "chrome/test/base/testing_profile_manager.h" 27 #include "chrome/test/base/testing_profile_manager.h"
29 #include "components/prefs/testing_pref_service.h" 28 #include "components/prefs/testing_pref_service.h"
30 #include "components/sync_preferences/testing_pref_service_syncable.h" 29 #include "components/sync_preferences/testing_pref_service_syncable.h"
31 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
32 #include "content/public/test/test_browser_thread.h" 31 #include "content/public/test/test_browser_thread_bundle.h"
33 #include "testing/gmock/include/gmock/gmock.h" 32 #include "testing/gmock/include/gmock/gmock.h"
34 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
35 34
36 using ::testing::Assign; 35 using ::testing::Assign;
37 using ::testing::AtMost; 36 using ::testing::AtMost;
38 using ::testing::DeleteArg; 37 using ::testing::DeleteArg;
39 using ::testing::DoAll; 38 using ::testing::DoAll;
40 using ::testing::Invoke; 39 using ::testing::Invoke;
41 using ::testing::Property; 40 using ::testing::Property;
42 using ::testing::Return; 41 using ::testing::Return;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 MockServiceProcessControl::EnabledUserId(), 198 MockServiceProcessControl::EnabledUserId(),
200 base::DictionaryValue()); 199 base::DictionaryValue());
201 } 200 }
202 201
203 private: 202 private:
204 MockServiceProcessControl process_control_; 203 MockServiceProcessControl process_control_;
205 }; 204 };
206 205
207 class CloudPrintProxyPolicyTest : public ::testing::Test { 206 class CloudPrintProxyPolicyTest : public ::testing::Test {
208 public: 207 public:
209 CloudPrintProxyPolicyTest() 208 CloudPrintProxyPolicyTest() = default;
210 : ui_thread_(content::BrowserThread::UI, &message_loop_) {
211 }
212 209
213 bool LaunchBrowser(const base::CommandLine& command_line, Profile* profile) { 210 bool LaunchBrowser(const base::CommandLine& command_line, Profile* profile) {
214 StartupBrowserCreator browser_creator; 211 StartupBrowserCreator browser_creator;
215 return browser_creator.ProcessCmdLineImpl( 212 return browser_creator.ProcessCmdLineImpl(
216 command_line, base::FilePath(), false, profile, 213 command_line, base::FilePath(), false, profile,
217 StartupBrowserCreator::Profiles()); 214 StartupBrowserCreator::Profiles());
218 } 215 }
219 216
220 protected: 217 protected:
221 base::MessageLoopForUI message_loop_; 218 content::TestBrowserThreadBundle test_browser_thread_bundle_;
222 content::TestBrowserThread ui_thread_;
223 TestingProfile profile_; 219 TestingProfile profile_;
224 }; 220 };
225 221
226 TEST_F(CloudPrintProxyPolicyTest, VerifyExpectations) { 222 TEST_F(CloudPrintProxyPolicyTest, VerifyExpectations) {
227 MockServiceProcessControl mock_control; 223 MockServiceProcessControl mock_control;
228 mock_control.SetConnectSuccessMockExpectations( 224 mock_control.SetConnectSuccessMockExpectations(
229 MockServiceProcessControl::kServiceStateNone, false); 225 MockServiceProcessControl::kServiceStateNone, false);
230 226
231 EXPECT_FALSE(mock_control.IsConnected()); 227 EXPECT_FALSE(mock_control.IsConnected());
232 mock_control.Launch(base::Closure(), base::Closure()); 228 mock_control.Launch(base::Closure(), base::Closure());
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 439
444 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled); 440 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled);
445 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 441 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
446 442
447 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations(); 443 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations();
448 service.EnableForUser(); 444 service.EnableForUser();
449 445
450 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), 446 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(),
451 prefs->GetString(prefs::kCloudPrintEmail)); 447 prefs->GetString(prefs::kCloudPrintEmail));
452 } 448 }
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_unittest.cc ('k') | chrome/browser/printing/cloud_print/gcd_api_flow_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698