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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "content/public/test/test_browser_context.h" | 9 #include "content/public/test/test_browser_context.h" |
10 #include "extensions/browser/api/extensions_api_client.h" | 10 #include "extensions/browser/api/extensions_api_client.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 return StorageFrontend::CreateForTesting(new LeveldbSettingsStorageFactory(), | 36 return StorageFrontend::CreateForTesting(new LeveldbSettingsStorageFactory(), |
37 context); | 37 context); |
38 } | 38 } |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 class StorageApiUnittest : public ApiUnitTest { | 42 class StorageApiUnittest : public ApiUnitTest { |
43 public: | 43 public: |
44 StorageApiUnittest() {} | 44 StorageApiUnittest() {} |
45 | 45 |
46 virtual void SetUp() OVERRIDE { | 46 virtual void SetUp() override { |
47 ApiUnitTest::SetUp(); | 47 ApiUnitTest::SetUp(); |
48 extensions_browser_client()->set_extension_system_factory( | 48 extensions_browser_client()->set_extension_system_factory( |
49 &extension_system_factory_); | 49 &extension_system_factory_); |
50 } | 50 } |
51 | 51 |
52 protected: | 52 protected: |
53 // Runs the storage.set() API function with local storage. | 53 // Runs the storage.set() API function with local storage. |
54 void RunSetFunction(const std::string& key, const std::string& value) { | 54 void RunSetFunction(const std::string& key, const std::string& value) { |
55 RunFunction( | 55 RunFunction( |
56 new StorageStorageAreaSetFunction(), | 56 new StorageStorageAreaSetFunction(), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 EXPECT_TRUE(leveldb_store->Get(kKey)->IsCorrupted()); | 116 EXPECT_TRUE(leveldb_store->Get(kKey)->IsCorrupted()); |
117 | 117 |
118 // Running another set should end up working (even though it will restore the | 118 // Running another set should end up working (even though it will restore the |
119 // store behind the scenes). | 119 // store behind the scenes). |
120 RunSetFunction(kKey, kValue); | 120 RunSetFunction(kKey, kValue); |
121 EXPECT_TRUE(RunGetFunction(kKey, &result)); | 121 EXPECT_TRUE(RunGetFunction(kKey, &result)); |
122 EXPECT_EQ(kValue, result); | 122 EXPECT_EQ(kValue, result); |
123 } | 123 } |
124 | 124 |
125 } // namespace extensions | 125 } // namespace extensions |
OLD | NEW |