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 "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 class UserCloudPolicyManagerChromeOSTest : public testing::Test { | 76 class UserCloudPolicyManagerChromeOSTest : public testing::Test { |
77 protected: | 77 protected: |
78 UserCloudPolicyManagerChromeOSTest() | 78 UserCloudPolicyManagerChromeOSTest() |
79 : store_(NULL), | 79 : store_(NULL), |
80 external_data_manager_(NULL), | 80 external_data_manager_(NULL), |
81 task_runner_(new base::TestSimpleTaskRunner()), | 81 task_runner_(new base::TestSimpleTaskRunner()), |
82 profile_(NULL), | 82 profile_(NULL), |
83 signin_profile_(NULL) {} | 83 signin_profile_(NULL) {} |
84 | 84 |
85 virtual void SetUp() OVERRIDE { | 85 virtual void SetUp() override { |
86 // The initialization path that blocks on the initial policy fetch requires | 86 // The initialization path that blocks on the initial policy fetch requires |
87 // a signin Profile to use its URLRequestContext. | 87 // a signin Profile to use its URLRequestContext. |
88 profile_manager_.reset( | 88 profile_manager_.reset( |
89 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 89 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
90 ASSERT_TRUE(profile_manager_->SetUp()); | 90 ASSERT_TRUE(profile_manager_->SetUp()); |
91 TestingProfile::TestingFactories factories; | 91 TestingProfile::TestingFactories factories; |
92 factories.push_back( | 92 factories.push_back( |
93 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), | 93 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), |
94 BuildFakeProfileOAuth2TokenService)); | 94 BuildFakeProfileOAuth2TokenService)); |
95 profile_ = profile_manager_->CreateTestingProfile( | 95 profile_ = profile_manager_->CreateTestingProfile( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 policy_data_.set_device_id("id987"); | 137 policy_data_.set_device_id("id987"); |
138 em::PolicyFetchResponse* policy_response = | 138 em::PolicyFetchResponse* policy_response = |
139 policy_blob_.mutable_policy_response()->add_response(); | 139 policy_blob_.mutable_policy_response()->add_response(); |
140 ASSERT_TRUE(policy_data_.SerializeToString( | 140 ASSERT_TRUE(policy_data_.SerializeToString( |
141 policy_response->mutable_policy_data())); | 141 policy_response->mutable_policy_data())); |
142 | 142 |
143 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) | 143 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) |
144 .Times(AnyNumber()); | 144 .Times(AnyNumber()); |
145 } | 145 } |
146 | 146 |
147 virtual void TearDown() OVERRIDE { | 147 virtual void TearDown() override { |
148 if (token_forwarder_) | 148 if (token_forwarder_) |
149 token_forwarder_->Shutdown(); | 149 token_forwarder_->Shutdown(); |
150 if (manager_) { | 150 if (manager_) { |
151 manager_->RemoveObserver(&observer_); | 151 manager_->RemoveObserver(&observer_); |
152 manager_->Shutdown(); | 152 manager_->Shutdown(); |
153 } | 153 } |
154 signin_profile_ = NULL; | 154 signin_profile_ = NULL; |
155 profile_ = NULL; | 155 profile_ = NULL; |
156 profile_manager_->DeleteTestingProfile(chrome::kInitialProfile); | 156 profile_manager_->DeleteTestingProfile(chrome::kInitialProfile); |
157 } | 157 } |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 582 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
583 EXPECT_TRUE(manager_->core()->client()->is_registered()); | 583 EXPECT_TRUE(manager_->core()->client()->is_registered()); |
584 | 584 |
585 // The refresh scheduler takes care of the initial fetch for unmanaged users. | 585 // The refresh scheduler takes care of the initial fetch for unmanaged users. |
586 // Running the task runner issues the initial fetch. | 586 // Running the task runner issues the initial fetch. |
587 FetchPolicy( | 587 FetchPolicy( |
588 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); | 588 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); |
589 } | 589 } |
590 | 590 |
591 } // namespace policy | 591 } // namespace policy |
OLD | NEW |