| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 // Set retry delay to prevent timeouts. | 60 // Set retry delay to prevent timeouts. |
| 61 policy::DeviceManagementService::SetRetryDelayForTesting(0); | 61 policy::DeviceManagementService::SetRetryDelayForTesting(0); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void SetUpOnMainThread() override { | 64 void SetUpOnMainThread() override { |
| 65 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service())) | 65 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service())) |
| 66 << "Pre-existing policies in this machine will make this test fail."; | 66 << "Pre-existing policies in this machine will make this test fail."; |
| 67 | 67 |
| 68 interceptor_.reset(new TestRequestInterceptor( | 68 interceptor_.reset(new TestRequestInterceptor( |
| 69 "localhost", | 69 "localhost", BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))); |
| 70 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | |
| 71 | 70 |
| 72 BrowserPolicyConnector* connector = | 71 BrowserPolicyConnector* connector = |
| 73 g_browser_process->browser_policy_connector(); | 72 g_browser_process->browser_policy_connector(); |
| 74 connector->ScheduleServiceInitialization(0); | 73 connector->ScheduleServiceInitialization(0); |
| 75 | 74 |
| 76 #if !defined(OS_CHROMEOS) | 75 #if !defined(OS_CHROMEOS) |
| 77 // Mock a signed-in user. This is used by the UserCloudPolicyStore to pass | 76 // Mock a signed-in user. This is used by the UserCloudPolicyStore to pass |
| 78 // the username to the UserCloudPolicyValidator. | 77 // the username to the UserCloudPolicyValidator. |
| 79 SigninManager* signin_manager = | 78 SigninManager* signin_manager = |
| 80 SigninManagerFactory::GetForProfile(browser()->profile()); | 79 SigninManagerFactory::GetForProfile(browser()->profile()); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 const bool expect_reregister = true; | 197 const bool expect_reregister = true; |
| 199 interceptor_->PushJobCallback( | 198 interceptor_->PushJobCallback( |
| 200 TestRequestInterceptor::RegisterJob(expected_type, expect_reregister)); | 199 TestRequestInterceptor::RegisterJob(expected_type, expect_reregister)); |
| 201 | 200 |
| 202 EXPECT_FALSE(policy_manager()->core()->client()->is_registered()); | 201 EXPECT_FALSE(policy_manager()->core()->client()->is_registered()); |
| 203 ASSERT_NO_FATAL_FAILURE(Register()); | 202 ASSERT_NO_FATAL_FAILURE(Register()); |
| 204 EXPECT_TRUE(policy_manager()->core()->client()->is_registered()); | 203 EXPECT_TRUE(policy_manager()->core()->client()->is_registered()); |
| 205 } | 204 } |
| 206 | 205 |
| 207 } // namespace policy | 206 } // namespace policy |
| OLD | NEW |