Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: chrome/browser/policy/cloud/component_cloud_policy_store_unittest.cc

Issue 23868021: Prepare ExternalPolicyDataUpdater and ResourceCache for blocking pool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-uploading due to rietveld flake. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/policy/cloud/component_cloud_policy_store.h" 5 #include "chrome/browser/policy/cloud/component_cloud_policy_store.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/sha1.h" 15 #include "base/sha1.h"
16 #include "base/test/test_simple_task_runner.h"
16 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" 17 #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
17 #include "chrome/browser/policy/cloud/policy_builder.h" 18 #include "chrome/browser/policy/cloud/policy_builder.h"
18 #include "chrome/browser/policy/cloud/resource_cache.h" 19 #include "chrome/browser/policy/cloud/resource_cache.h"
19 #include "chrome/browser/policy/external_data_fetcher.h" 20 #include "chrome/browser/policy/external_data_fetcher.h"
20 #include "chrome/browser/policy/proto/cloud/chrome_extension_policy.pb.h" 21 #include "chrome/browser/policy/proto/cloud/chrome_extension_policy.pb.h"
21 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" 22 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h"
22 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 25
25 namespace em = enterprise_management; 26 namespace em = enterprise_management;
(...skipping 28 matching lines...) Expand all
54 55
55 MOCK_METHOD0(OnComponentCloudPolicyStoreUpdated, void()); 56 MOCK_METHOD0(OnComponentCloudPolicyStoreUpdated, void());
56 }; 57 };
57 58
58 } // namespace 59 } // namespace
59 60
60 class ComponentCloudPolicyStoreTest : public testing::Test { 61 class ComponentCloudPolicyStoreTest : public testing::Test {
61 protected: 62 protected:
62 virtual void SetUp() OVERRIDE { 63 virtual void SetUp() OVERRIDE {
63 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 64 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
64 cache_.reset(new ResourceCache(temp_dir_.path())); 65 cache_.reset(new ResourceCache(
66 temp_dir_.path(),
67 make_scoped_refptr(new base::TestSimpleTaskRunner)));
65 store_.reset(new ComponentCloudPolicyStore(&store_delegate_, cache_.get())); 68 store_.reset(new ComponentCloudPolicyStore(&store_delegate_, cache_.get()));
66 store_->SetCredentials(ComponentPolicyBuilder::kFakeUsername, 69 store_->SetCredentials(ComponentPolicyBuilder::kFakeUsername,
67 ComponentPolicyBuilder::kFakeToken); 70 ComponentPolicyBuilder::kFakeToken);
68 71
69 builder_.policy_data().set_policy_type( 72 builder_.policy_data().set_policy_type(
70 dm_protocol::kChromeExtensionPolicyType); 73 dm_protocol::kChromeExtensionPolicyType);
71 builder_.policy_data().set_settings_entity_id(kTestExtension); 74 builder_.policy_data().set_settings_entity_id(kTestExtension);
72 builder_.payload().set_download_url(kTestDownload); 75 builder_.payload().set_download_url(kTestDownload);
73 builder_.payload().set_secure_hash(TestPolicyHash()); 76 builder_.payload().set_secure_hash(TestPolicyHash());
74 77
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 310
308 // And they aren't loaded anymore either. 311 // And they aren't loaded anymore either.
309 ComponentCloudPolicyStore yet_another_store(&store_delegate_, cache_.get()); 312 ComponentCloudPolicyStore yet_another_store(&store_delegate_, cache_.get());
310 yet_another_store.SetCredentials(ComponentPolicyBuilder::kFakeUsername, 313 yet_another_store.SetCredentials(ComponentPolicyBuilder::kFakeUsername,
311 ComponentPolicyBuilder::kFakeToken); 314 ComponentPolicyBuilder::kFakeToken);
312 yet_another_store.Load(); 315 yet_another_store.Load();
313 EXPECT_TRUE(yet_another_store.policy().Equals(empty_bundle)); 316 EXPECT_TRUE(yet_another_store.policy().Equals(empty_bundle));
314 } 317 }
315 318
316 } // namespace policy 319 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698