OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "chrome/browser/value_store/value_store_frontend.h" | 10 #include "chrome/browser/value_store/value_store_frontend.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 file_thread_(BrowserThread::FILE, base::MessageLoop::current()) { | 23 file_thread_(BrowserThread::FILE, base::MessageLoop::current()) { |
24 } | 24 } |
25 | 25 |
26 virtual void SetUp() { | 26 virtual void SetUp() { |
27 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 27 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
28 | 28 |
29 base::FilePath test_data_dir; | 29 base::FilePath test_data_dir; |
30 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); | 30 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); |
31 base::FilePath src_db(test_data_dir.AppendASCII("value_store_db")); | 31 base::FilePath src_db(test_data_dir.AppendASCII("value_store_db")); |
32 db_path_ = temp_dir_.path().AppendASCII("temp_db"); | 32 db_path_ = temp_dir_.path().AppendASCII("temp_db"); |
33 file_util::CopyDirectory(src_db, db_path_, true); | 33 base::CopyDirectory(src_db, db_path_, true); |
34 | 34 |
35 ResetStorage(); | 35 ResetStorage(); |
36 } | 36 } |
37 | 37 |
38 virtual void TearDown() { | 38 virtual void TearDown() { |
39 base::MessageLoop::current()->RunUntilIdle(); // wait for storage to delete | 39 base::MessageLoop::current()->RunUntilIdle(); // wait for storage to delete |
40 storage_.reset(); | 40 storage_.reset(); |
41 } | 41 } |
42 | 42 |
43 // Reset the value store, reloading the DB from disk. | 43 // Reset the value store, reloading the DB from disk. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 { | 108 { |
109 ASSERT_TRUE(Get("key1", &value)); | 109 ASSERT_TRUE(Get("key1", &value)); |
110 std::string result; | 110 std::string result; |
111 ASSERT_TRUE(value->GetAsString(&result)); | 111 ASSERT_TRUE(value->GetAsString(&result)); |
112 EXPECT_EQ("new1", result); | 112 EXPECT_EQ("new1", result); |
113 } | 113 } |
114 | 114 |
115 ASSERT_FALSE(Get("key2", &value)); | 115 ASSERT_FALSE(Get("key2", &value)); |
116 } | 116 } |
OLD | NEW |