| OLD | NEW |
| 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> |
| 10 |
| 9 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/test/test_simple_task_runner.h" | 14 #include "base/test/test_simple_task_runner.h" |
| 14 #include "components/policy/core/common/cloud/resource_cache.h" | 15 #include "components/policy/core/common/cloud/resource_cache.h" |
| 15 #include "crypto/sha2.h" | 16 #include "crypto/sha2.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 namespace policy { | 19 namespace policy { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 const char kKey1[] = "Key 1"; | 23 const char kKey1[] = "Key 1"; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 35 CouldExternalDataStoreTest(); | 36 CouldExternalDataStoreTest(); |
| 36 | 37 |
| 37 void SetUp() override; | 38 void SetUp() override; |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 const std::string kData1Hash; | 41 const std::string kData1Hash; |
| 41 const std::string kData2Hash; | 42 const std::string kData2Hash; |
| 42 | 43 |
| 43 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; | 44 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
| 44 base::ScopedTempDir temp_dir_; | 45 base::ScopedTempDir temp_dir_; |
| 45 scoped_ptr<ResourceCache> resource_cache_; | 46 std::unique_ptr<ResourceCache> resource_cache_; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(CouldExternalDataStoreTest); | 49 DISALLOW_COPY_AND_ASSIGN(CouldExternalDataStoreTest); |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 CouldExternalDataStoreTest::CouldExternalDataStoreTest() | 52 CouldExternalDataStoreTest::CouldExternalDataStoreTest() |
| 52 : kData1Hash(crypto::SHA256HashString(kData1)), | 53 : kData1Hash(crypto::SHA256HashString(kData1)), |
| 53 kData2Hash(crypto::SHA256HashString(kData2)), | 54 kData2Hash(crypto::SHA256HashString(kData2)), |
| 54 task_runner_(new base::TestSimpleTaskRunner) { | 55 task_runner_(new base::TestSimpleTaskRunner) { |
| 55 } | 56 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 EXPECT_TRUE(contents.empty()); | 194 EXPECT_TRUE(contents.empty()); |
| 194 | 195 |
| 195 // 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 |
| 196 // unaffected. | 197 // unaffected. |
| 197 resource_cache_->LoadAllSubkeys(kKey2, &contents); | 198 resource_cache_->LoadAllSubkeys(kKey2, &contents); |
| 198 ASSERT_EQ(1u, contents.size()); | 199 ASSERT_EQ(1u, contents.size()); |
| 199 EXPECT_EQ(kData2, contents.begin()->second); | 200 EXPECT_EQ(kData2, contents.begin()->second); |
| 200 } | 201 } |
| 201 | 202 |
| 202 } // namespace policy | 203 } // namespace policy |
| OLD | NEW |