Chromium Code Reviews| 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/cloud/user_cloud_policy_manager.h" | 5 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/files/file_path.h" | |
|
bartfab (slow)
2013/11/25 15:05:50
Nit: Already included by header file.
Joao da Silva
2013/11/25 16:44:11
Done.
| |
| 8 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
| 11 #include "chrome/browser/policy/cloud/cloud_external_data_manager.h" | 12 #include "chrome/browser/policy/cloud/cloud_external_data_manager.h" |
| 12 #include "chrome/browser/policy/cloud/mock_user_cloud_policy_store.h" | 13 #include "chrome/browser/policy/cloud/mock_user_cloud_policy_store.h" |
| 13 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 14 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
| 14 #include "components/policy/core/common/external_data_fetcher.h" | 15 #include "components/policy/core/common/external_data_fetcher.h" |
| 15 #include "components/policy/core/common/schema_registry.h" | 16 #include "components/policy/core/common/schema_registry.h" |
| 16 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 45 manager_->Shutdown(); | 46 manager_->Shutdown(); |
| 46 } | 47 } |
| 47 } | 48 } |
| 48 | 49 |
| 49 void CreateManager() { | 50 void CreateManager() { |
| 50 store_ = new MockUserCloudPolicyStore(); | 51 store_ = new MockUserCloudPolicyStore(); |
| 51 EXPECT_CALL(*store_, Load()); | 52 EXPECT_CALL(*store_, Load()); |
| 52 manager_.reset(new UserCloudPolicyManager( | 53 manager_.reset(new UserCloudPolicyManager( |
| 53 NULL, | 54 NULL, |
| 54 scoped_ptr<UserCloudPolicyStore>(store_), | 55 scoped_ptr<UserCloudPolicyStore>(store_), |
| 56 base::FilePath(), | |
| 55 scoped_ptr<CloudExternalDataManager>(), | 57 scoped_ptr<CloudExternalDataManager>(), |
| 58 loop_.message_loop_proxy(), | |
| 59 loop_.message_loop_proxy(), | |
| 56 loop_.message_loop_proxy())); | 60 loop_.message_loop_proxy())); |
| 57 manager_->Init(&schema_registry_); | 61 manager_->Init(&schema_registry_); |
| 58 manager_->AddObserver(&observer_); | 62 manager_->AddObserver(&observer_); |
| 59 Mock::VerifyAndClearExpectations(store_); | 63 Mock::VerifyAndClearExpectations(store_); |
| 60 } | 64 } |
| 61 | 65 |
| 62 // Required by the refresh scheduler that's created by the manager. | 66 // Required by the refresh scheduler that's created by the manager. |
| 63 base::MessageLoop loop_; | 67 base::MessageLoop loop_; |
| 64 | 68 |
| 65 // Convenience policy objects. | 69 // Convenience policy objects. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 85 store_->NotifyStoreLoaded(); | 89 store_->NotifyStoreLoaded(); |
| 86 EXPECT_TRUE(expected_bundle_.Equals(manager_->policies())); | 90 EXPECT_TRUE(expected_bundle_.Equals(manager_->policies())); |
| 87 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 91 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
| 88 EXPECT_CALL(*store_, Clear()); | 92 EXPECT_CALL(*store_, Clear()); |
| 89 manager_->DisconnectAndRemovePolicy(); | 93 manager_->DisconnectAndRemovePolicy(); |
| 90 EXPECT_FALSE(manager_->core()->service()); | 94 EXPECT_FALSE(manager_->core()->service()); |
| 91 } | 95 } |
| 92 | 96 |
| 93 } // namespace | 97 } // namespace |
| 94 } // namespace policy | 98 } // namespace policy |
| OLD | NEW |