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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; | 335 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
336 SchemaRegistry schema_registry_; | 336 SchemaRegistry schema_registry_; |
337 scoped_ptr<UserCloudPolicyManagerChromeOS> manager_; | 337 scoped_ptr<UserCloudPolicyManagerChromeOS> manager_; |
338 scoped_ptr<UserCloudPolicyTokenForwarder> token_forwarder_; | 338 scoped_ptr<UserCloudPolicyTokenForwarder> token_forwarder_; |
339 | 339 |
340 // Required by ProfileHelper to get the signin Profile context. | 340 // Required by ProfileHelper to get the signin Profile context. |
341 scoped_ptr<TestingProfileManager> profile_manager_; | 341 scoped_ptr<TestingProfileManager> profile_manager_; |
342 TestingProfile* profile_; | 342 TestingProfile* profile_; |
343 TestingProfile* signin_profile_; | 343 TestingProfile* signin_profile_; |
344 | 344 |
345 static const char kSigninProfile[]; | |
346 | |
347 private: | 345 private: |
348 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOSTest); | 346 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOSTest); |
349 }; | 347 }; |
350 | 348 |
351 const char UserCloudPolicyManagerChromeOSTest::kSigninProfile[] = | |
352 "signin_profile"; | |
353 | |
354 TEST_F(UserCloudPolicyManagerChromeOSTest, BlockingFirstFetch) { | 349 TEST_F(UserCloudPolicyManagerChromeOSTest, BlockingFirstFetch) { |
355 // Tests the initialization of a manager whose Profile is waiting for the | 350 // Tests the initialization of a manager whose Profile is waiting for the |
356 // initial fetch, when the policy cache is empty. | 351 // initial fetch, when the policy cache is empty. |
357 ASSERT_NO_FATAL_FAILURE(CreateManager(true, 1000)); | 352 ASSERT_NO_FATAL_FAILURE(CreateManager(true, 1000)); |
358 | 353 |
359 // Initialize the CloudPolicyService without any stored data. | 354 // Initialize the CloudPolicyService without any stored data. |
360 EXPECT_FALSE(manager_->core()->service()->IsInitializationComplete()); | 355 EXPECT_FALSE(manager_->core()->service()->IsInitializationComplete()); |
361 store_->NotifyStoreLoaded(); | 356 store_->NotifyStoreLoaded(); |
362 EXPECT_TRUE(manager_->core()->service()->IsInitializationComplete()); | 357 EXPECT_TRUE(manager_->core()->service()->IsInitializationComplete()); |
363 EXPECT_FALSE(manager_->core()->client()->is_registered()); | 358 EXPECT_FALSE(manager_->core()->client()->is_registered()); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 582 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
588 EXPECT_TRUE(manager_->core()->client()->is_registered()); | 583 EXPECT_TRUE(manager_->core()->client()->is_registered()); |
589 | 584 |
590 // 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. |
591 // Running the task runner issues the initial fetch. | 586 // Running the task runner issues the initial fetch. |
592 FetchPolicy( | 587 FetchPolicy( |
593 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); | 588 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); |
594 } | 589 } |
595 | 590 |
596 } // namespace policy | 591 } // namespace policy |
OLD | NEW |