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" |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); | 415 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); |
416 | 416 |
417 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations(); | 417 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations(); |
418 service.EnableForUser(std::string(), | 418 service.EnableForUser(std::string(), |
419 MockServiceProcessControl::EnabledUserId()); | 419 MockServiceProcessControl::EnabledUserId()); |
420 | 420 |
421 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), | 421 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), |
422 prefs->GetString(prefs::kCloudPrintEmail)); | 422 prefs->GetString(prefs::kCloudPrintEmail)); |
423 } | 423 } |
424 | 424 |
425 ProfileKeyedService* TestCloudPrintProxyServiceFactory( | 425 BrowserContextKeyedService* TestCloudPrintProxyServiceFactory( |
426 content::BrowserContext* profile) { | 426 content::BrowserContext* profile) { |
427 TestCloudPrintProxyService* service = | 427 TestCloudPrintProxyService* service = |
428 new TestCloudPrintProxyService(static_cast<Profile*>(profile)); | 428 new TestCloudPrintProxyService(static_cast<Profile*>(profile)); |
429 | 429 |
430 service->GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( | 430 service->GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( |
431 MockServiceProcessControl::kServiceStateEnabled, true); | 431 MockServiceProcessControl::kServiceStateEnabled, true); |
432 service->GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); | 432 service->GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); |
433 | 433 |
434 service->Initialize(); | 434 service->Initialize(); |
435 MessageLoop::current()->RunUntilIdle(); | 435 MessageLoop::current()->RunUntilIdle(); |
436 return service; | 436 return service; |
437 } | 437 } |
438 | 438 |
439 TEST_F(CloudPrintProxyPolicyTest, StartupBrowserCreatorWithCommandLine) { | 439 TEST_F(CloudPrintProxyPolicyTest, StartupBrowserCreatorWithCommandLine) { |
440 TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); | 440 TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); |
441 prefs->SetUserPref(prefs::kCloudPrintEmail, | 441 prefs->SetUserPref(prefs::kCloudPrintEmail, |
442 Value::CreateStringValue(std::string())); | 442 Value::CreateStringValue(std::string())); |
443 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, | 443 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, |
444 Value::CreateBooleanValue(false)); | 444 Value::CreateBooleanValue(false)); |
445 | 445 |
446 CloudPrintProxyServiceFactory::GetInstance()-> | 446 CloudPrintProxyServiceFactory::GetInstance()-> |
447 SetTestingFactory(&profile_, TestCloudPrintProxyServiceFactory); | 447 SetTestingFactory(&profile_, TestCloudPrintProxyServiceFactory); |
448 | 448 |
449 CommandLine command_line(CommandLine::NO_PROGRAM); | 449 CommandLine command_line(CommandLine::NO_PROGRAM); |
450 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); | 450 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); |
451 | 451 |
452 EXPECT_FALSE(LaunchBrowser(command_line, &profile_)); | 452 EXPECT_FALSE(LaunchBrowser(command_line, &profile_)); |
453 MessageLoop::current()->RunUntilIdle(); | 453 MessageLoop::current()->RunUntilIdle(); |
454 } | 454 } |
OLD | NEW |