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/policy/user_cloud_policy_store.h" | 5 #include "chrome/browser/policy/user_cloud_policy_store.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
9 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
10 #include "base/scoped_temp_dir.h" | |
11 #include "chrome/browser/policy/policy_builder.h" | 11 #include "chrome/browser/policy/policy_builder.h" |
12 #include "chrome/browser/signin/signin_manager.h" | 12 #include "chrome/browser/signin/signin_manager.h" |
13 #include "chrome/browser/signin/signin_manager_factory.h" | 13 #include "chrome/browser/signin/signin_manager_factory.h" |
14 #include "chrome/browser/signin/signin_manager_fake.h" | 14 #include "chrome/browser/signin/signin_manager_fake.h" |
15 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
16 #include "content/public/test/test_browser_thread.h" | 16 #include "content/public/test/test_browser_thread.h" |
17 #include "policy/policy_constants.h" | 17 #include "policy/policy_constants.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 scoped_ptr<UserCloudPolicyStore> store_; | 96 scoped_ptr<UserCloudPolicyStore> store_; |
97 | 97 |
98 // CloudPolicyValidator() requires a FILE thread so declare one here. Both | 98 // CloudPolicyValidator() requires a FILE thread so declare one here. Both |
99 // |ui_thread_| and |file_thread_| share the same MessageLoop |loop_| so | 99 // |ui_thread_| and |file_thread_| share the same MessageLoop |loop_| so |
100 // callers can use RunLoop to manage both virtual threads. | 100 // callers can use RunLoop to manage both virtual threads. |
101 MessageLoop loop_; | 101 MessageLoop loop_; |
102 content::TestBrowserThread ui_thread_; | 102 content::TestBrowserThread ui_thread_; |
103 content::TestBrowserThread file_thread_; | 103 content::TestBrowserThread file_thread_; |
104 | 104 |
105 scoped_ptr<TestingProfile> profile_; | 105 scoped_ptr<TestingProfile> profile_; |
106 ScopedTempDir tmp_dir_; | 106 base::ScopedTempDir tmp_dir_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreTest); | 108 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreTest); |
109 }; | 109 }; |
110 | 110 |
111 TEST_F(UserCloudPolicyStoreTest, LoadWithNoFile) { | 111 TEST_F(UserCloudPolicyStoreTest, LoadWithNoFile) { |
112 EXPECT_FALSE(store_->policy()); | 112 EXPECT_FALSE(store_->policy()); |
113 EXPECT_TRUE(store_->policy_map().empty()); | 113 EXPECT_TRUE(store_->policy_map().empty()); |
114 | 114 |
115 EXPECT_CALL(observer_, OnStoreLoaded(store_.get())); | 115 EXPECT_CALL(observer_, OnStoreLoaded(store_.get())); |
116 store_->Load(); | 116 store_->Load(); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 store2->Load(); | 267 store2->Load(); |
268 RunUntilIdle(); | 268 RunUntilIdle(); |
269 | 269 |
270 ASSERT_FALSE(store2->policy()); | 270 ASSERT_FALSE(store2->policy()); |
271 store2->RemoveObserver(&observer_); | 271 store2->RemoveObserver(&observer_); |
272 } | 272 } |
273 | 273 |
274 } // namespace | 274 } // namespace |
275 | 275 |
276 } // namespace policy | 276 } // namespace policy |
OLD | NEW |