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

Unified Diff: chrome/browser/ui/webui/options/preferences_browsertest.cc

Issue 11415226: webui/options: Do not use Value::CreateStringValue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/options/preferences_browsertest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/preferences_browsertest.cc
diff --git a/chrome/browser/ui/webui/options/preferences_browsertest.cc b/chrome/browser/ui/webui/options/preferences_browsertest.cc
index 2fe90a97c59a039021061d05b6fd3dcad9d69ef6..3a51a60e032fa8a4699eca0dcfcc37266aefca34 100644
--- a/chrome/browser/ui/webui/options/preferences_browsertest.cc
+++ b/chrome/browser/ui/webui/options/preferences_browsertest.cc
@@ -201,13 +201,12 @@ void PreferencesBrowserTest::SetUserValues(
pref_service_->Set(names[i].c_str(), *values[i]);
}
-void PreferencesBrowserTest::VerifyKeyValue(const base::DictionaryValue* dict,
+void PreferencesBrowserTest::VerifyKeyValue(const base::DictionaryValue& dict,
const std::string& key,
- base::Value* expected) {
+ const base::Value& expected) {
const base::Value* actual = NULL;
- EXPECT_TRUE(dict->Get(key, &actual)) << "Was checking key: " << key;
- EXPECT_EQ(*expected, *actual) << "Was checking key: " << key;
- delete expected;
+ EXPECT_TRUE(dict.Get(key, &actual)) << "Was checking key: " << key;
+ EXPECT_EQ(expected, *actual) << "Was checking key: " << key;
}
void PreferencesBrowserTest::VerifyPref(const base::DictionaryValue* prefs,
@@ -220,21 +219,20 @@ void PreferencesBrowserTest::VerifyPref(const base::DictionaryValue* prefs,
const base::DictionaryValue* dict;
ASSERT_TRUE(prefs->GetWithoutPathExpansion(name, &pref));
ASSERT_TRUE(pref->GetAsDictionary(&dict));
- VerifyKeyValue(dict, "value", value->DeepCopy());
+ VerifyKeyValue(*dict, "value", *value);
if (!controlledBy.empty()) {
- VerifyKeyValue(dict, "controlledBy",
- base::Value::CreateStringValue(controlledBy));
+ VerifyKeyValue(*dict, "controlledBy", base::StringValue(controlledBy));
} else {
EXPECT_FALSE(dict->HasKey("controlledBy"));
}
if (disabled)
- VerifyKeyValue(dict, "disabled", base::Value::CreateBooleanValue(true));
+ VerifyKeyValue(*dict, "disabled", base::FundamentalValue(true));
else if (dict->HasKey("disabled"))
- VerifyKeyValue(dict, "disabled", base::Value::CreateBooleanValue(false));
+ VerifyKeyValue(*dict, "disabled", base::FundamentalValue(false));
if (uncommitted)
- VerifyKeyValue(dict, "uncommitted", base::Value::CreateBooleanValue(true));
+ VerifyKeyValue(*dict, "uncommitted", base::FundamentalValue(true));
else if (dict->HasKey("uncommitted"))
- VerifyKeyValue(dict, "uncommitted", base::Value::CreateBooleanValue(false));
+ VerifyKeyValue(*dict, "uncommitted", base::FundamentalValue(false));
}
void PreferencesBrowserTest::VerifyObservedPref(const std::string& json,
@@ -326,7 +324,7 @@ void PreferencesBrowserTest::VerifySetPref(const std::string& name,
ExpectSetCommit(name, value);
else
ExpectNoCommit(name);
- scoped_ptr<base::Value> commit_ptr(base::Value::CreateBooleanValue(commit));
+ scoped_ptr<base::Value> commit_ptr(new base::FundamentalValue(commit));
std::string value_json;
std::string commit_json;
base::JSONWriter::Write(value, &value_json);
@@ -351,7 +349,7 @@ void PreferencesBrowserTest::VerifyClearPref(const std::string& name,
ExpectClearCommit(name);
else
ExpectNoCommit(name);
- scoped_ptr<base::Value> commit_ptr(base::Value::CreateBooleanValue(commit));
+ scoped_ptr<base::Value> commit_ptr(new base::FundamentalValue(commit));
std::string commit_json;
base::JSONWriter::Write(commit_ptr.get(), &commit_json);
std::wstringstream javascript;
@@ -424,26 +422,26 @@ void PreferencesBrowserTest::UseDefaultTestPrefs(bool includeListPref) {
types_.push_back("Boolean");
pref_names_.push_back(prefs::kAlternateErrorPagesEnabled);
policy_names_.push_back(policy::key::kAlternateErrorPagesEnabled);
- non_default_values_.push_back(base::Value::CreateBooleanValue(false));
+ non_default_values_.push_back(new base::FundamentalValue(false));
// Integer pref.
types_.push_back("Integer");
pref_names_.push_back(prefs::kRestoreOnStartup);
policy_names_.push_back(policy::key::kRestoreOnStartup);
- non_default_values_.push_back(base::Value::CreateIntegerValue(4));
+ non_default_values_.push_back(new base::FundamentalValue(4));
// String pref.
types_.push_back("String");
pref_names_.push_back(prefs::kEnterpriseWebStoreName);
policy_names_.push_back(policy::key::kEnterpriseWebStoreName);
- non_default_values_.push_back(base::Value::CreateStringValue("Store"));
+ non_default_values_.push_back(new base::StringValue("Store"));
// URL pref.
types_.push_back("URL");
pref_names_.push_back(prefs::kEnterpriseWebStoreURL);
policy_names_.push_back(policy::key::kEnterpriseWebStoreURL);
non_default_values_.push_back(
- base::Value::CreateStringValue("http://www.google.com/"));
+ new base::StringValue("http://www.google.com/"));
// List pref.
if (includeListPref) {
@@ -451,8 +449,8 @@ void PreferencesBrowserTest::UseDefaultTestPrefs(bool includeListPref) {
pref_names_.push_back(prefs::kURLsToRestoreOnStartup);
policy_names_.push_back(policy::key::kRestoreOnStartupURLs);
base::ListValue* list = new base::ListValue;
- list->Append(base::Value::CreateStringValue("http://www.google.com"));
- list->Append(base::Value::CreateStringValue("http://example.com"));
+ list->Append(new base::StringValue("http://www.google.com"));
+ list->Append(new base::StringValue("http://example.com"));
non_default_values_.push_back(list);
}
@@ -642,16 +640,15 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, ChromeOSDeviceFetchPrefs) {
// Boolean pref.
pref_names_.push_back(chromeos::kAccountsPrefAllowGuest);
- default_values_.push_back(base::Value::CreateBooleanValue(true));
- non_default_values_.push_back(base::Value::CreateBooleanValue(false));
+ default_values_.push_back(new base::FundamentalValue(true));
+ non_default_values_.push_back(new base::FundamentalValue(false));
decorated_non_default_values.push_back(
non_default_values_.back()->DeepCopy());
// String pref.
pref_names_.push_back(chromeos::kReleaseChannel);
- default_values_.push_back(base::Value::CreateStringValue(""));
- non_default_values_.push_back(
- base::Value::CreateStringValue("stable-channel"));
+ default_values_.push_back(new base::StringValue(""));
+ non_default_values_.push_back(new base::StringValue("stable-channel"));
decorated_non_default_values.push_back(
non_default_values_.back()->DeepCopy());
@@ -659,8 +656,8 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, ChromeOSDeviceFetchPrefs) {
pref_names_.push_back(chromeos::kAccountsPrefUsers);
default_values_.push_back(new base::ListValue);
base::ListValue* list = new base::ListValue;
- list->Append(base::Value::CreateStringValue("me@google.com"));
- list->Append(base::Value::CreateStringValue("you@google.com"));
+ list->Append(new base::StringValue("me@google.com"));
+ list->Append(new base::StringValue("you@google.com"));
non_default_values_.push_back(list);
list = new base::ListValue;
base::DictionaryValue* dict = new base::DictionaryValue;
@@ -704,25 +701,25 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, ChromeOSProxyFetchPrefs) {
// Boolean pref.
pref_names_.push_back(chromeos::kProxySingle);
- default_values_.push_back(base::Value::CreateBooleanValue(false));
- non_default_values_.push_back(base::Value::CreateBooleanValue(true));
+ default_values_.push_back(new base::FundamentalValue(false));
+ non_default_values_.push_back(new base::FundamentalValue(true));
// Integer pref.
pref_names_.push_back(chromeos::kProxySingleHttpPort);
- default_values_.push_back(base::Value::CreateStringValue(""));
- non_default_values_.push_back(base::Value::CreateIntegerValue(8080));
+ default_values_.push_back(new base::StringValue(""));
+ non_default_values_.push_back(new base::FundamentalValue(8080));
// String pref.
pref_names_.push_back(chromeos::kProxySingleHttp);
- default_values_.push_back(base::Value::CreateStringValue(""));
- non_default_values_.push_back(base::Value::CreateStringValue("127.0.0.1"));
+ default_values_.push_back(new base::StringValue(""));
+ non_default_values_.push_back(new base::StringValue("127.0.0.1"));
// List pref.
pref_names_.push_back(chromeos::kProxyIgnoreList);
default_values_.push_back(new base::ListValue());
base::ListValue* list = new base::ListValue();
- list->Append(base::Value::CreateStringValue("www.google.com"));
- list->Append(base::Value::CreateStringValue("example.com"));
+ list->Append(new base::StringValue("www.google.com"));
+ list->Append(new base::StringValue("example.com"));
non_default_values_.push_back(list);
// Verify notifications when default values are in effect.
« no previous file with comments | « chrome/browser/ui/webui/options/preferences_browsertest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698