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