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

Side by Side Diff: chrome/common/pref_service_unittest.cc

Issue 441008: Many changes to DictionaryValues:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/test/data/resource.h" 5 #include "app/test/data/resource.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "chrome/browser/chrome_thread.h" 9 #include "chrome/browser/chrome_thread.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
11 #include "chrome/common/json_value_serializer.h" 11 #include "chrome/common/json_value_serializer.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 std::wstring homepage(L"http://www.example.com"); 110 std::wstring homepage(L"http://www.example.com");
111 111
112 EXPECT_EQ(cnn, prefs.GetString(prefs::kHomePage)); 112 EXPECT_EQ(cnn, prefs.GetString(prefs::kHomePage));
113 113
114 const wchar_t kSomeDirectory[] = L"some_directory"; 114 const wchar_t kSomeDirectory[] = L"some_directory";
115 FilePath some_path(FILE_PATH_LITERAL("/usr/sbin/")); 115 FilePath some_path(FILE_PATH_LITERAL("/usr/sbin/"));
116 prefs.RegisterFilePathPref(kSomeDirectory, FilePath()); 116 prefs.RegisterFilePathPref(kSomeDirectory, FilePath());
117 117
118 // Now test that the transient value overrides the persistent value, 118 // Now test that the transient value overrides the persistent value,
119 // without actually altering the persistent store. 119 // without actually altering the persistent store.
120 EXPECT_TRUE(prefs.transient()->SetString(prefs::kHomePage, microsoft)); 120 prefs.transient()->SetString(prefs::kHomePage, microsoft);
121 EXPECT_TRUE(prefs.transient()->GetString(prefs::kHomePage, &homepage)); 121 EXPECT_TRUE(prefs.transient()->GetString(prefs::kHomePage, &homepage));
122 EXPECT_EQ(microsoft, homepage); 122 EXPECT_EQ(microsoft, homepage);
123 123
124 EXPECT_EQ(microsoft, prefs.GetString(prefs::kHomePage)); 124 EXPECT_EQ(microsoft, prefs.GetString(prefs::kHomePage));
125 125
126 // Test reading some other data types from sub-dictionaries, and 126 // Test reading some other data types from sub-dictionaries, and
127 // writing to the persistent store. 127 // writing to the persistent store.
128 EXPECT_TRUE(prefs.GetBoolean(kNewWindowsInTabs)); 128 EXPECT_TRUE(prefs.GetBoolean(kNewWindowsInTabs));
129 prefs.SetBoolean(kNewWindowsInTabs, false); 129 prefs.SetBoolean(kNewWindowsInTabs, false);
130 EXPECT_FALSE(prefs.GetBoolean(kNewWindowsInTabs)); 130 EXPECT_FALSE(prefs.GetBoolean(kNewWindowsInTabs));
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 // Register the path. This doesn't set a value, so the path still shouldn't 403 // Register the path. This doesn't set a value, so the path still shouldn't
404 // exist. 404 // exist.
405 prefs.RegisterStringPref(path, std::wstring()); 405 prefs.RegisterStringPref(path, std::wstring());
406 EXPECT_FALSE(prefs.HasPrefPath(path)); 406 EXPECT_FALSE(prefs.HasPrefPath(path));
407 407
408 // Set a value and make sure we have a path. 408 // Set a value and make sure we have a path.
409 prefs.SetString(path, L"blah"); 409 prefs.SetString(path, L"blah");
410 EXPECT_TRUE(prefs.HasPrefPath(path)); 410 EXPECT_TRUE(prefs.HasPrefPath(path));
411 } 411 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698