Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: chrome/browser/extensions/extension_settings_storage_unittest.h

Issue 7977018: Enable sync for the settings from the Extension Settings API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix race condition in ExtensionSettingsUIWrapper::Core Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_STORAGE_UNITTEST_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_STORAGE_UNITTEST_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_STORAGE_UNITTEST_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_STORAGE_UNITTEST_H_
7 #pragma once 7 #pragma once
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/scoped_temp_dir.h"
14 #include "base/task.h" 15 #include "base/task.h"
15 #include "chrome/browser/extensions/extension_settings.h" 16 #include "chrome/browser/extensions/extension_settings.h"
16 #include "content/browser/browser_thread.h" 17 #include "content/browser/browser_thread.h"
17 18
18 // Parameter type for the value-parameterized tests. 19 // Parameter type for the value-parameterized tests.
19 typedef ExtensionSettingsStorage* (*ExtensionSettingsStorageTestParam)( 20 typedef ExtensionSettingsStorage* (*ExtensionSettingsStorageTestParam)(
20 ExtensionSettings* settings, const std::string& extension_id); 21 const ExtensionSettings& settings, const std::string& extension_id);
21 22
22 // Test fixture for ExtensionSettingsStorage tests. Tests are defined in 23 // Test fixture for ExtensionSettingsStorage tests. Tests are defined in
23 // extension_settings_storage_unittest.cc with configurations for both cached 24 // extension_settings_storage_unittest.cc with configurations for both cached
24 // and non-cached leveldb storage, and cached no-op storage. 25 // and non-cached leveldb storage, and cached no-op storage.
25 class ExtensionSettingsStorageTest 26 class ExtensionSettingsStorageTest
26 : public testing::TestWithParam<ExtensionSettingsStorageTestParam> { 27 : public testing::TestWithParam<ExtensionSettingsStorageTestParam> {
27 public: 28 public:
28 ExtensionSettingsStorageTest(); 29 ExtensionSettingsStorageTest();
29 virtual ~ExtensionSettingsStorageTest(); 30 virtual ~ExtensionSettingsStorageTest();
30 31
31 virtual void SetUp() OVERRIDE; 32 virtual void SetUp() OVERRIDE;
33 virtual void TearDown() OVERRIDE;
32 34
33 protected: 35 protected:
34 ExtensionSettingsStorage* storage_; 36 ExtensionSettingsStorage* storage_;
35 37
36 std::string key1_; 38 std::string key1_;
37 std::string key2_; 39 std::string key2_;
38 std::string key3_; 40 std::string key3_;
39 41
40 scoped_ptr<Value> val1_; 42 scoped_ptr<Value> val1_;
41 scoped_ptr<Value> val2_; 43 scoped_ptr<Value> val2_;
42 scoped_ptr<Value> val3_; 44 scoped_ptr<Value> val3_;
43 45
44 std::vector<std::string> empty_list_; 46 std::vector<std::string> empty_list_;
45 std::vector<std::string> list1_; 47 std::vector<std::string> list1_;
46 std::vector<std::string> list2_; 48 std::vector<std::string> list2_;
47 std::vector<std::string> list12_; 49 std::vector<std::string> list12_;
48 std::vector<std::string> list13_; 50 std::vector<std::string> list13_;
49 std::vector<std::string> list123_; 51 std::vector<std::string> list123_;
50 52
51 scoped_ptr<DictionaryValue> empty_dict_; 53 scoped_ptr<DictionaryValue> empty_dict_;
52 scoped_ptr<DictionaryValue> dict1_; 54 scoped_ptr<DictionaryValue> dict1_;
53 scoped_ptr<DictionaryValue> dict12_; 55 scoped_ptr<DictionaryValue> dict12_;
54 scoped_ptr<DictionaryValue> dict123_; 56 scoped_ptr<DictionaryValue> dict123_;
55 57
56 private: 58 private:
57 scoped_refptr<ExtensionSettings> settings_; 59 ScopedTempDir temp_dir_;
60 scoped_ptr<ExtensionSettings> settings_;
58 61
59 // Need these so that the DCHECKs for running on FILE or UI threads pass. 62 // Need these so that the DCHECKs for running on FILE or UI threads pass.
60 scoped_ptr<MessageLoopForUI> ui_message_loop_; 63 MessageLoop message_loop_;
61 scoped_ptr<BrowserThread> ui_thread_; 64 BrowserThread ui_thread_;
62 scoped_ptr<BrowserThread> file_thread_; 65 BrowserThread file_thread_;
63 }; 66 };
64 67
65 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_STORAGE_UNITTEST_H_ 68 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_STORAGE_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698