| 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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 429 |
| 430 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled); | 430 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled); |
| 431 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); | 431 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); |
| 432 | 432 |
| 433 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations(); | 433 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations(); |
| 434 service.EnableForUser(); | 434 service.EnableForUser(); |
| 435 | 435 |
| 436 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), | 436 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), |
| 437 prefs->GetString(prefs::kCloudPrintEmail)); | 437 prefs->GetString(prefs::kCloudPrintEmail)); |
| 438 } | 438 } |
| 439 | |
| 440 KeyedService* TestCloudPrintProxyServiceFactory( | |
| 441 content::BrowserContext* profile) { | |
| 442 TestCloudPrintProxyService* service = | |
| 443 new TestCloudPrintProxyService(static_cast<Profile*>(profile)); | |
| 444 | |
| 445 service->GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( | |
| 446 MockServiceProcessControl::kServiceStateEnabled, true); | |
| 447 service->GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); | |
| 448 | |
| 449 service->Initialize(); | |
| 450 return service; | |
| 451 } | |
| 452 | |
| 453 TEST_F(CloudPrintProxyPolicyTest, StartupBrowserCreatorWithCommandLine) { | |
| 454 TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); | |
| 455 prefs->SetUserPref(prefs::kCloudPrintEmail, | |
| 456 new base::StringValue(std::string())); | |
| 457 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, | |
| 458 new base::FundamentalValue(false)); | |
| 459 | |
| 460 CloudPrintProxyServiceFactory::GetInstance()-> | |
| 461 SetTestingFactory(&profile_, TestCloudPrintProxyServiceFactory); | |
| 462 | |
| 463 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | |
| 464 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); | |
| 465 | |
| 466 EXPECT_FALSE(LaunchBrowser(command_line, &profile_)); | |
| 467 base::RunLoop().RunUntilIdle(); | |
| 468 } | |
| OLD | NEW |