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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_UNITTEST_H_
6 #define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_UNITTEST_H_
8 #include "base/files/scoped_temp_dir.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h"
12 #include "content/public/test/test_browser_thread.h"
13 #include "extensions/browser/value_store/value_store.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 // Parameter type for the value-parameterized tests.
17 typedef ValueStore
* (*ValueStoreTestParam
)(const base::FilePath
& file_path
);
19 // Test fixture for ValueStore tests. Tests are defined in
20 // settings_storage_unittest.cc with configurations for both cached
21 // and non-cached leveldb storage, and cached no-op storage.
22 class ValueStoreTest
: public testing::TestWithParam
<ValueStoreTestParam
> {
25 virtual ~ValueStoreTest();
27 void SetUp() override
;
28 void TearDown() override
;
31 scoped_ptr
<ValueStore
> storage_
;
37 scoped_ptr
<base::Value
> val1_
;
38 scoped_ptr
<base::Value
> val2_
;
39 scoped_ptr
<base::Value
> val3_
;
41 std::vector
<std::string
> empty_list_
;
42 std::vector
<std::string
> list1_
;
43 std::vector
<std::string
> list2_
;
44 std::vector
<std::string
> list3_
;
45 std::vector
<std::string
> list12_
;
46 std::vector
<std::string
> list13_
;
47 std::vector
<std::string
> list123_
;
49 std::set
<std::string
> empty_set_
;
50 std::set
<std::string
> set1_
;
51 std::set
<std::string
> set2_
;
52 std::set
<std::string
> set3_
;
53 std::set
<std::string
> set12_
;
54 std::set
<std::string
> set13_
;
55 std::set
<std::string
> set123_
;
57 scoped_ptr
<base::DictionaryValue
> empty_dict_
;
58 scoped_ptr
<base::DictionaryValue
> dict1_
;
59 scoped_ptr
<base::DictionaryValue
> dict3_
;
60 scoped_ptr
<base::DictionaryValue
> dict12_
;
61 scoped_ptr
<base::DictionaryValue
> dict123_
;
64 base::ScopedTempDir temp_dir_
;
66 // Need these so that the DCHECKs for running on FILE or UI threads pass.
67 base::MessageLoop message_loop_
;
68 content::TestBrowserThread ui_thread_
;
69 content::TestBrowserThread file_thread_
;
72 #endif // EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_UNITTEST_H_