| OLD | NEW |
| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
| 11 #include "chrome/browser/operation_output.h" |
| 11 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 12 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 12 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 13 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 13 #include "chrome/browser/service/service_process_control.h" | 14 #include "chrome/browser/service/service_process_control.h" |
| 14 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 15 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/cloud_print/cloud_print_proxy_info.h" | 17 #include "chrome/common/cloud_print/cloud_print_proxy_info.h" |
| 17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 18 #include "chrome/common/service_messages.h" | 19 #include "chrome/common/service_messages.h" |
| 19 #include "chrome/test/base/testing_browser_process.h" | 20 #include "chrome/test/base/testing_browser_process.h" |
| 20 #include "chrome/test/base/testing_pref_service_syncable.h" | 21 #include "chrome/test/base/testing_pref_service_syncable.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 MockServiceProcessControl process_control_; | 182 MockServiceProcessControl process_control_; |
| 182 }; | 183 }; |
| 183 | 184 |
| 184 class CloudPrintProxyPolicyTest : public ::testing::Test { | 185 class CloudPrintProxyPolicyTest : public ::testing::Test { |
| 185 public: | 186 public: |
| 186 CloudPrintProxyPolicyTest() | 187 CloudPrintProxyPolicyTest() |
| 187 : ui_thread_(content::BrowserThread::UI, &message_loop_) { | 188 : ui_thread_(content::BrowserThread::UI, &message_loop_) { |
| 188 } | 189 } |
| 189 | 190 |
| 190 bool LaunchBrowser(const CommandLine& command_line, Profile* profile) { | 191 bool LaunchBrowser(const CommandLine& command_line, Profile* profile) { |
| 191 int return_code = 0; | |
| 192 StartupBrowserCreator browser_creator; | 192 StartupBrowserCreator browser_creator; |
| 193 return StartupBrowserCreator::ProcessCmdLineImpl( | 193 return StartupBrowserCreator::ProcessCmdLineImpl( |
| 194 command_line, base::FilePath(), false, profile, | 194 command_line, base::FilePath(), false, profile, |
| 195 StartupBrowserCreator::Profiles(), &return_code, &browser_creator); | 195 StartupBrowserCreator::Profiles(), &browser_creator, |
| 196 scoped_ptr<OperationOutput>()); |
| 196 } | 197 } |
| 197 | 198 |
| 198 protected: | 199 protected: |
| 199 MessageLoopForUI message_loop_; | 200 MessageLoopForUI message_loop_; |
| 200 content::TestBrowserThread ui_thread_; | 201 content::TestBrowserThread ui_thread_; |
| 201 TestingProfile profile_; | 202 TestingProfile profile_; |
| 202 }; | 203 }; |
| 203 | 204 |
| 204 TEST_F(CloudPrintProxyPolicyTest, VerifyExpectations) { | 205 TEST_F(CloudPrintProxyPolicyTest, VerifyExpectations) { |
| 205 MockServiceProcessControl mock_control; | 206 MockServiceProcessControl mock_control; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 444 |
| 444 CloudPrintProxyServiceFactory::GetInstance()-> | 445 CloudPrintProxyServiceFactory::GetInstance()-> |
| 445 SetTestingFactory(&profile_, TestCloudPrintProxyServiceFactory); | 446 SetTestingFactory(&profile_, TestCloudPrintProxyServiceFactory); |
| 446 | 447 |
| 447 CommandLine command_line(CommandLine::NO_PROGRAM); | 448 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 448 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); | 449 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); |
| 449 | 450 |
| 450 EXPECT_FALSE(LaunchBrowser(command_line, &profile_)); | 451 EXPECT_FALSE(LaunchBrowser(command_line, &profile_)); |
| 451 MessageLoop::current()->RunUntilIdle(); | 452 MessageLoop::current()->RunUntilIdle(); |
| 452 } | 453 } |
| OLD | NEW |