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

Unified Diff: chrome/browser/policy/configuration_policy_pref_store_unittest.cc

Issue 10908226: Introduces a search term extraction mechanism working for arbitrary search providers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed need for espv=1 for search term extraction. Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/configuration_policy_pref_store_unittest.cc
diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
index 62c983dde2d1ae1df06989b6ff5c8f9c64d74046..aaf5c754b582bf5b5825abaf674a211ac38fd94e 100644
--- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
@@ -597,6 +597,11 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MinimallyDefined) {
EXPECT_EQ(PrefStore::READ_OK,
store_->GetValue(prefs::kDefaultSearchProviderInstantURL, &value));
EXPECT_TRUE(base::StringValue(std::string()).Equals(value));
+
+ EXPECT_EQ(PrefStore::READ_OK,
+ store_->GetValue(prefs::kDefaultSearchProviderAlternateURLs,
+ &value));
+ EXPECT_TRUE(base::ListValue().Equals(value));
}
// Checks that for a fully defined search policy, all elements have been
@@ -609,8 +614,11 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, FullyDefined) {
const char* const name = "MyName";
const char* const keyword = "MyKeyword";
base::ListValue* encodings = new base::ListValue();
- encodings->Append(base::Value::CreateStringValue("UTF-16"));
- encodings->Append(base::Value::CreateStringValue("UTF-8"));
+ encodings->AppendString("UTF-16");
+ encodings->AppendString("UTF-8");
+ base::ListValue* alternate_urls = new base::ListValue();
+ alternate_urls->AppendString("http://www.google.com/#q={searchTerms}");
+ alternate_urls->AppendString("http://www.google.com/search#q={searchTerms}");
policy.Set(key::kDefaultSearchProviderEnabled, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true));
policy.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY,
@@ -625,6 +633,8 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, FullyDefined) {
POLICY_SCOPE_USER, base::Value::CreateStringValue(icon_url));
policy.Set(key::kDefaultSearchProviderEncodings, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, encodings);
+ policy.Set(key::kDefaultSearchProviderAlternateURLs, POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER, alternate_urls);
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
@@ -651,6 +661,10 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, FullyDefined) {
EXPECT_EQ(PrefStore::READ_OK,
store_->GetValue(prefs::kDefaultSearchProviderEncodings, &value));
EXPECT_TRUE(base::StringValue("UTF-16;UTF-8").Equals(value));
+
+ EXPECT_EQ(PrefStore::READ_OK, store_->GetValue(
+ prefs::kDefaultSearchProviderAlternateURLs, &value));
+ EXPECT_TRUE(alternate_urls->Equals(value));
}
// Checks that if the default search policy is missing, that no elements of the
@@ -662,8 +676,11 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MissingUrl) {
const char* const name = "MyName";
const char* const keyword = "MyKeyword";
base::ListValue* encodings = new base::ListValue();
- encodings->Append(base::Value::CreateStringValue("UTF-16"));
- encodings->Append(base::Value::CreateStringValue("UTF-8"));
+ encodings->AppendString("UTF-16");
+ encodings->AppendString("UTF-8");
+ base::ListValue* alternate_urls = new base::ListValue();
+ alternate_urls->AppendString("http://www.google.com/#q={searchTerms}");
+ alternate_urls->AppendString("http://www.google.com/search#q={searchTerms}");
policy.Set(key::kDefaultSearchProviderEnabled, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true));
policy.Set(key::kDefaultSearchProviderName, POLICY_LEVEL_MANDATORY,
@@ -676,6 +693,8 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MissingUrl) {
POLICY_SCOPE_USER, base::Value::CreateStringValue(icon_url));
policy.Set(key::kDefaultSearchProviderEncodings, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, encodings);
+ policy.Set(key::kDefaultSearchProviderAlternateURLs, POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER, alternate_urls);
provider_.UpdateChromePolicy(policy);
EXPECT_EQ(PrefStore::READ_NO_VALUE,
@@ -690,6 +709,8 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MissingUrl) {
store_->GetValue(prefs::kDefaultSearchProviderIconURL, NULL));
EXPECT_EQ(PrefStore::READ_NO_VALUE,
store_->GetValue(prefs::kDefaultSearchProviderEncodings, NULL));
+ EXPECT_EQ(PrefStore::READ_NO_VALUE,
+ store_->GetValue(prefs::kDefaultSearchProviderAlternateURLs, NULL));
}
// Checks that if the default search policy is invalid, that no elements of the
@@ -702,8 +723,11 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, Invalid) {
const char* const name = "MyName";
const char* const keyword = "MyKeyword";
base::ListValue* encodings = new base::ListValue();
- encodings->Append(base::Value::CreateStringValue("UTF-16"));
- encodings->Append(base::Value::CreateStringValue("UTF-8"));
+ encodings->AppendString("UTF-16");
+ encodings->AppendString("UTF-8");
+ base::ListValue* alternate_urls = new base::ListValue();
+ alternate_urls->AppendString("http://www.google.com/#q={searchTerms}");
+ alternate_urls->AppendString("http://www.google.com/search#q={searchTerms}");
policy.Set(key::kDefaultSearchProviderEnabled, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true));
policy.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY,
@@ -719,6 +743,8 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, Invalid) {
POLICY_SCOPE_USER, base::Value::CreateStringValue(icon_url));
policy.Set(key::kDefaultSearchProviderEncodings, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, encodings);
+ policy.Set(key::kDefaultSearchProviderAlternateURLs, POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER, alternate_urls);
provider_.UpdateChromePolicy(policy);
EXPECT_EQ(PrefStore::READ_NO_VALUE,
@@ -733,6 +759,8 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, Invalid) {
store_->GetValue(prefs::kDefaultSearchProviderIconURL, NULL));
EXPECT_EQ(PrefStore::READ_NO_VALUE,
store_->GetValue(prefs::kDefaultSearchProviderEncodings, NULL));
+ EXPECT_EQ(PrefStore::READ_NO_VALUE,
+ store_->GetValue(prefs::kDefaultSearchProviderAlternateURLs, NULL));
}
// Checks that if the default search policy is invalid, that no elements of the

Powered by Google App Engine
This is Rietveld 408576698