| 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 "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 test_server_.reset(new LocalPolicyTestServer(policy_file_path())); | 155 test_server_.reset(new LocalPolicyTestServer(policy_file_path())); |
| 156 ASSERT_TRUE(test_server_->Start()); | 156 ASSERT_TRUE(test_server_->Start()); |
| 157 | 157 |
| 158 std::string url = test_server_->GetServiceURL().spec(); | 158 std::string url = test_server_->GetServiceURL().spec(); |
| 159 | 159 |
| 160 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 160 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 161 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url); | 161 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url); |
| 162 command_line->AppendSwitch(switches::kEnablePolicyKeyVerification); | 162 command_line->AppendSwitch(switches::kEnablePolicyKeyVerification); |
| 163 | 163 |
| 164 invalidation::InvalidationServiceFactory::GetInstance()-> | 164 invalidation::InvalidationServiceFactory::GetInstance()-> |
| 165 SetBuildOnlyFakeInvalidatorsForTest(true); | 165 RegisterTestingFactory(invalidation::FakeInvalidationService::Build); |
| 166 } | 166 } |
| 167 | 167 |
| 168 virtual void SetUpOnMainThread() OVERRIDE { | 168 virtual void SetUpOnMainThread() OVERRIDE { |
| 169 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service())) | 169 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service())) |
| 170 << "Pre-existing policies in this machine will make this test fail."; | 170 << "Pre-existing policies in this machine will make this test fail."; |
| 171 | 171 |
| 172 BrowserPolicyConnector* connector = | 172 BrowserPolicyConnector* connector = |
| 173 g_browser_process->browser_policy_connector(); | 173 g_browser_process->browser_policy_connector(); |
| 174 connector->ScheduleServiceInitialization(0); | 174 connector->ScheduleServiceInitialization(0); |
| 175 | 175 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 425 |
| 426 // They should now serialize to the same bytes. | 426 // They should now serialize to the same bytes. |
| 427 std::string chrome_settings_serialized; | 427 std::string chrome_settings_serialized; |
| 428 std::string cloud_policy_serialized; | 428 std::string cloud_policy_serialized; |
| 429 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); | 429 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); |
| 430 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); | 430 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); |
| 431 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); | 431 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); |
| 432 } | 432 } |
| 433 | 433 |
| 434 } // namespace policy | 434 } // namespace policy |
| OLD | NEW |