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

Side by Side Diff: chrome/browser/chromeos/policy/cloud_external_data_store_unittest.cc

Issue 2318023002: //chrome/browser/chromeos: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Address comment and also remove non-trivial cases Created 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/chromeos/policy/cloud_external_data_store.h" 5 #include "chrome/browser/chromeos/policy/cloud_external_data_store.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 }; 50 };
51 51
52 CouldExternalDataStoreTest::CouldExternalDataStoreTest() 52 CouldExternalDataStoreTest::CouldExternalDataStoreTest()
53 : kData1Hash(crypto::SHA256HashString(kData1)), 53 : kData1Hash(crypto::SHA256HashString(kData1)),
54 kData2Hash(crypto::SHA256HashString(kData2)), 54 kData2Hash(crypto::SHA256HashString(kData2)),
55 task_runner_(new base::TestSimpleTaskRunner) { 55 task_runner_(new base::TestSimpleTaskRunner) {
56 } 56 }
57 57
58 void CouldExternalDataStoreTest::SetUp() { 58 void CouldExternalDataStoreTest::SetUp() {
59 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 59 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
60 resource_cache_.reset(new ResourceCache(temp_dir_.path(), task_runner_)); 60 resource_cache_.reset(new ResourceCache(temp_dir_.GetPath(), task_runner_));
61 } 61 }
62 62
63 TEST_F(CouldExternalDataStoreTest, StoreAndLoad) { 63 TEST_F(CouldExternalDataStoreTest, StoreAndLoad) {
64 // Write an entry to a store. 64 // Write an entry to a store.
65 CloudExternalDataStore store(kKey1, task_runner_, resource_cache_.get()); 65 CloudExternalDataStore store(kKey1, task_runner_, resource_cache_.get());
66 EXPECT_TRUE(store.Store(kPolicy1, kData1Hash, kData1)); 66 EXPECT_TRUE(store.Store(kPolicy1, kData1Hash, kData1));
67 67
68 // Check that loading and verifying the entry against an invalid hash fails. 68 // Check that loading and verifying the entry against an invalid hash fails.
69 std::string data; 69 std::string data;
70 EXPECT_FALSE(store.Load(kPolicy1, kData2Hash, kMaxSize, &data)); 70 EXPECT_FALSE(store.Load(kPolicy1, kData2Hash, kMaxSize, &data));
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 EXPECT_TRUE(contents.empty()); 194 EXPECT_TRUE(contents.empty());
195 195
196 // Check that the part of the resource cache backing the second store is 196 // Check that the part of the resource cache backing the second store is
197 // unaffected. 197 // unaffected.
198 resource_cache_->LoadAllSubkeys(kKey2, &contents); 198 resource_cache_->LoadAllSubkeys(kKey2, &contents);
199 ASSERT_EQ(1u, contents.size()); 199 ASSERT_EQ(1u, contents.size());
200 EXPECT_EQ(kData2, contents.begin()->second); 200 EXPECT_EQ(kData2, contents.begin()->second);
201 } 201 }
202 202
203 } // namespace policy 203 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698