| 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 "extensions/browser/value_store/value_store_frontend.h" | 5 #include "extensions/browser/value_store/value_store_frontend.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 : ui_thread_(BrowserThread::UI, base::MessageLoop::current()), | 25 : ui_thread_(BrowserThread::UI, base::MessageLoop::current()), |
| 26 file_thread_(BrowserThread::FILE, base::MessageLoop::current()) { | 26 file_thread_(BrowserThread::FILE, base::MessageLoop::current()) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 void SetUp() override { | 29 void SetUp() override { |
| 30 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 30 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 31 | 31 |
| 32 base::FilePath test_data_dir; | 32 base::FilePath test_data_dir; |
| 33 ASSERT_TRUE(PathService::Get(extensions::DIR_TEST_DATA, &test_data_dir)); | 33 ASSERT_TRUE(PathService::Get(extensions::DIR_TEST_DATA, &test_data_dir)); |
| 34 base::FilePath src_db(test_data_dir.AppendASCII("value_store_db")); | 34 base::FilePath src_db(test_data_dir.AppendASCII("value_store_db")); |
| 35 db_path_ = temp_dir_.path().AppendASCII("temp_db"); | 35 db_path_ = temp_dir_.GetPath().AppendASCII("temp_db"); |
| 36 base::CopyDirectory(src_db, db_path_, true); | 36 base::CopyDirectory(src_db, db_path_, true); |
| 37 | 37 |
| 38 factory_ = new extensions::TestValueStoreFactory(db_path_); | 38 factory_ = new extensions::TestValueStoreFactory(db_path_); |
| 39 | 39 |
| 40 ResetStorage(); | 40 ResetStorage(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void TearDown() override { | 43 void TearDown() override { |
| 44 base::RunLoop().RunUntilIdle(); // wait for storage to delete | 44 base::RunLoop().RunUntilIdle(); // wait for storage to delete |
| 45 storage_.reset(); | 45 storage_.reset(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 { | 115 { |
| 116 ASSERT_TRUE(Get("key1", &value)); | 116 ASSERT_TRUE(Get("key1", &value)); |
| 117 std::string result; | 117 std::string result; |
| 118 ASSERT_TRUE(value->GetAsString(&result)); | 118 ASSERT_TRUE(value->GetAsString(&result)); |
| 119 EXPECT_EQ("new1", result); | 119 EXPECT_EQ("new1", result); |
| 120 } | 120 } |
| 121 | 121 |
| 122 ASSERT_FALSE(Get("key2", &value)); | 122 ASSERT_FALSE(Get("key2", &value)); |
| 123 } | 123 } |
| OLD | NEW |