OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/leveldb_pref_store.h" | 5 #include "chrome/browser/prefs/leveldb_pref_store.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 class MockReadErrorDelegate : public PersistentPrefStore::ReadErrorDelegate { | 26 class MockReadErrorDelegate : public PersistentPrefStore::ReadErrorDelegate { |
27 public: | 27 public: |
28 MOCK_METHOD1(OnError, void(PersistentPrefStore::PrefReadError)); | 28 MOCK_METHOD1(OnError, void(PersistentPrefStore::PrefReadError)); |
29 }; | 29 }; |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 class LevelDBPrefStoreTest : public testing::Test { | 33 class LevelDBPrefStoreTest : public testing::Test { |
34 protected: | 34 protected: |
35 virtual void SetUp() OVERRIDE { | 35 virtual void SetUp() override { |
36 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 36 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
37 | 37 |
38 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); | 38 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); |
39 data_dir_ = data_dir_.AppendASCII("prefs"); | 39 data_dir_ = data_dir_.AppendASCII("prefs"); |
40 ASSERT_TRUE(PathExists(data_dir_)); | 40 ASSERT_TRUE(PathExists(data_dir_)); |
41 } | 41 } |
42 | 42 |
43 virtual void TearDown() OVERRIDE { | 43 virtual void TearDown() override { |
44 Close(); | 44 Close(); |
45 } | 45 } |
46 | 46 |
47 void Open() { | 47 void Open() { |
48 pref_store_ = new LevelDBPrefStore( | 48 pref_store_ = new LevelDBPrefStore( |
49 temp_dir_.path(), message_loop_.message_loop_proxy().get()); | 49 temp_dir_.path(), message_loop_.message_loop_proxy().get()); |
50 EXPECT_EQ(LevelDBPrefStore::PREF_READ_ERROR_NONE, pref_store_->ReadPrefs()); | 50 EXPECT_EQ(LevelDBPrefStore::PREF_READ_ERROR_NONE, pref_store_->ReadPrefs()); |
51 } | 51 } |
52 | 52 |
53 void Close() { | 53 void Close() { |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 295 |
296 EXPECT_TRUE(pref_store_->GetValue("dictionary", &value)); | 296 EXPECT_TRUE(pref_store_->GetValue("dictionary", &value)); |
297 EXPECT_TRUE(base::Value::Equals(golden_dict_value.get(), value)); | 297 EXPECT_TRUE(base::Value::Equals(golden_dict_value.get(), value)); |
298 | 298 |
299 EXPECT_TRUE(pref_store_->GetValue("list", &value)); | 299 EXPECT_TRUE(pref_store_->GetValue("list", &value)); |
300 EXPECT_TRUE(base::Value::Equals(golden_list_value.get(), value)); | 300 EXPECT_TRUE(base::Value::Equals(golden_list_value.get(), value)); |
301 | 301 |
302 EXPECT_TRUE(pref_store_->GetValue("compound_value", &value)); | 302 EXPECT_TRUE(pref_store_->GetValue("compound_value", &value)); |
303 EXPECT_TRUE(base::Value::Equals(golden_compound_value.get(), value)); | 303 EXPECT_TRUE(base::Value::Equals(golden_compound_value.get(), value)); |
304 } | 304 } |
OLD | NEW |