| 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/prefs/pref_hash_store_impl.h" | 5 #include "chrome/browser/prefs/tracked/pref_hash_store_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/prefs/pref_hash_store_impl.h" | |
| 12 #include "chrome/browser/prefs/pref_hash_store_transaction.h" | |
| 13 #include "chrome/browser/prefs/tracked/dictionary_hash_store_contents.h" | 11 #include "chrome/browser/prefs/tracked/dictionary_hash_store_contents.h" |
| 14 #include "chrome/browser/prefs/tracked/hash_store_contents.h" | 12 #include "chrome/browser/prefs/tracked/hash_store_contents.h" |
| 13 #include "chrome/browser/prefs/tracked/pref_hash_store_impl.h" |
| 14 #include "chrome/browser/prefs/tracked/pref_hash_store_transaction.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 class PrefHashStoreImplTest : public testing::Test { | 17 class PrefHashStoreImplTest : public testing::Test { |
| 18 protected: | 18 protected: |
| 19 scoped_ptr<HashStoreContents> CreateHashStoreContents() { | 19 scoped_ptr<HashStoreContents> CreateHashStoreContents() { |
| 20 return scoped_ptr<HashStoreContents>( | 20 return scoped_ptr<HashStoreContents>( |
| 21 new DictionaryHashStoreContents(&pref_store_contents_)); | 21 new DictionaryHashStoreContents(&pref_store_contents_)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 private: | 24 private: |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 // Load a new |pref_hash_store2| in which the hashes dictionary is trusted. | 466 // Load a new |pref_hash_store2| in which the hashes dictionary is trusted. |
| 467 PrefHashStoreImpl pref_hash_store2(std::string(32, 0), "device_id", true); | 467 PrefHashStoreImpl pref_hash_store2(std::string(32, 0), "device_id", true); |
| 468 scoped_ptr<PrefHashStoreTransaction> transaction( | 468 scoped_ptr<PrefHashStoreTransaction> transaction( |
| 469 pref_hash_store2.BeginTransaction(CreateHashStoreContents())); | 469 pref_hash_store2.BeginTransaction(CreateHashStoreContents())); |
| 470 std::vector<std::string> invalid_keys; | 470 std::vector<std::string> invalid_keys; |
| 471 EXPECT_EQ(PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE, | 471 EXPECT_EQ(PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE, |
| 472 transaction->CheckSplitValue("path1", &dict, &invalid_keys)); | 472 transaction->CheckSplitValue("path1", &dict, &invalid_keys)); |
| 473 EXPECT_TRUE(invalid_keys.empty()); | 473 EXPECT_TRUE(invalid_keys.empty()); |
| 474 } | 474 } |
| 475 } | 475 } |
| OLD | NEW |