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

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

Issue 7775008: Enable sync for the settings from the Extension Settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Comments, GCC compile fix 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 #include "chrome/browser/extensions/extension_settings_storage_unittest.h" 5 #include "chrome/browser/extensions/extension_settings_storage_unittest.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/extension_settings.h" 10 #include "chrome/browser/extensions/extension_settings.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void ExtensionSettingsStorageTest::SetUp() { 79 void ExtensionSettingsStorageTest::SetUp() {
80 ui_message_loop_.reset(new MessageLoopForUI()); 80 ui_message_loop_.reset(new MessageLoopForUI());
81 ui_thread_.reset( 81 ui_thread_.reset(
82 new BrowserThread(BrowserThread::UI, MessageLoop::current())); 82 new BrowserThread(BrowserThread::UI, MessageLoop::current()));
83 file_thread_.reset( 83 file_thread_.reset(
84 new BrowserThread(BrowserThread::FILE, MessageLoop::current())); 84 new BrowserThread(BrowserThread::FILE, MessageLoop::current()));
85 85
86 FilePath temp_dir; 86 FilePath temp_dir;
87 file_util::CreateNewTempDirectory(FilePath::StringType(), &temp_dir); 87 file_util::CreateNewTempDirectory(FilePath::StringType(), &temp_dir);
88 settings_ = new ExtensionSettings(temp_dir); 88 settings_ = new ExtensionSettings(temp_dir);
89 storage_ = (GetParam())(settings_.get(), "fakeExtension"); 89 storage_ = (GetParam())(settings_, "fakeExtension");
90 DCHECK(storage_ != NULL); 90 ASSERT_TRUE(storage_ != NULL);
91 }
92
93 void ExtensionSettingsStorageTest::TearDown() {
94 BrowserThread::DeleteSoon(BrowserThread::FILE, FROM_HERE, settings_);
95 MessageLoop::current()->RunAllPending();
91 } 96 }
92 97
93 TEST_P(ExtensionSettingsStorageTest, GetWhenEmpty) { 98 TEST_P(ExtensionSettingsStorageTest, GetWhenEmpty) {
94 ASSERT_PRED_FORMAT2(SettingsEq, empty_dict_.get(), storage_->Get(key1_)); 99 ASSERT_PRED_FORMAT2(SettingsEq, empty_dict_.get(), storage_->Get(key1_));
95 ASSERT_PRED_FORMAT2(SettingsEq, 100 ASSERT_PRED_FORMAT2(SettingsEq,
96 empty_dict_.get(), storage_->Get(empty_list_)); 101 empty_dict_.get(), storage_->Get(empty_list_));
97 ASSERT_PRED_FORMAT2(SettingsEq, empty_dict_.get(), storage_->Get(list123_)); 102 ASSERT_PRED_FORMAT2(SettingsEq, empty_dict_.get(), storage_->Get(list123_));
98 ASSERT_PRED_FORMAT2(SettingsEq, empty_dict_.get(), storage_->Get()); 103 ASSERT_PRED_FORMAT2(SettingsEq, empty_dict_.get(), storage_->Get());
99 } 104 }
100 105
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 TEST_P(ExtensionSettingsStorageTest, DotsInKeyNamesWithDicts) { 238 TEST_P(ExtensionSettingsStorageTest, DotsInKeyNamesWithDicts) {
234 DictionaryValue outer_dict; 239 DictionaryValue outer_dict;
235 DictionaryValue* inner_dict = new DictionaryValue(); 240 DictionaryValue* inner_dict = new DictionaryValue();
236 outer_dict.Set("foo", inner_dict); 241 outer_dict.Set("foo", inner_dict);
237 inner_dict->Set("bar", Value::CreateStringValue("baz")); 242 inner_dict->Set("bar", Value::CreateStringValue("baz"));
238 243
239 ASSERT_PRED_FORMAT2(SettingsEq, &outer_dict, storage_->Set(outer_dict)); 244 ASSERT_PRED_FORMAT2(SettingsEq, &outer_dict, storage_->Set(outer_dict));
240 ASSERT_PRED_FORMAT2(SettingsEq, &outer_dict, storage_->Get("foo")); 245 ASSERT_PRED_FORMAT2(SettingsEq, &outer_dict, storage_->Get("foo"));
241 ASSERT_PRED_FORMAT2(SettingsEq, empty_dict_.get(), storage_->Get("foo.bar")); 246 ASSERT_PRED_FORMAT2(SettingsEq, empty_dict_.get(), storage_->Get("foo.bar"));
242 } 247 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698