OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/search_engines/default_search_pref_test_util.h" | 5 #include "components/search_engines/default_search_pref_test_util.h" |
6 | 6 |
7 #include "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "components/search_engines/default_search_manager.h" | 8 #include "components/search_engines/default_search_manager.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 const std::string& search_terms_replacement_key) { | 22 const std::string& search_terms_replacement_key) { |
23 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue); | 23 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue); |
24 if (!enabled) { | 24 if (!enabled) { |
25 value->SetBoolean(DefaultSearchManager::kDisabledByPolicy, true); | 25 value->SetBoolean(DefaultSearchManager::kDisabledByPolicy, true); |
26 return value.Pass(); | 26 return value.Pass(); |
27 } | 27 } |
28 | 28 |
29 EXPECT_FALSE(keyword.empty()); | 29 EXPECT_FALSE(keyword.empty()); |
30 EXPECT_FALSE(search_url.empty()); | 30 EXPECT_FALSE(search_url.empty()); |
31 value->Set(DefaultSearchManager::kShortName, | 31 value->Set(DefaultSearchManager::kShortName, |
32 base::Value::CreateStringValue(name)); | 32 new base::StringValue(name)); |
33 value->Set(DefaultSearchManager::kKeyword, | 33 value->Set(DefaultSearchManager::kKeyword, |
34 base::Value::CreateStringValue(keyword)); | 34 new base::StringValue(keyword)); |
35 value->Set(DefaultSearchManager::kURL, | 35 value->Set(DefaultSearchManager::kURL, |
36 base::Value::CreateStringValue(search_url)); | 36 new base::StringValue(search_url)); |
37 value->Set(DefaultSearchManager::kSuggestionsURL, | 37 value->Set(DefaultSearchManager::kSuggestionsURL, |
38 base::Value::CreateStringValue(suggest_url)); | 38 new base::StringValue(suggest_url)); |
39 value->Set(DefaultSearchManager::kFaviconURL, | 39 value->Set(DefaultSearchManager::kFaviconURL, |
40 base::Value::CreateStringValue(icon_url)); | 40 new base::StringValue(icon_url)); |
41 value->Set(DefaultSearchManager::kSearchTermsReplacementKey, | 41 value->Set(DefaultSearchManager::kSearchTermsReplacementKey, |
42 base::Value::CreateStringValue(search_terms_replacement_key)); | 42 new base::StringValue(search_terms_replacement_key)); |
43 | 43 |
44 std::vector<std::string> encodings_items; | 44 std::vector<std::string> encodings_items; |
45 base::SplitString(encodings, ';', &encodings_items); | 45 base::SplitString(encodings, ';', &encodings_items); |
46 scoped_ptr<base::ListValue> encodings_list(new base::ListValue); | 46 scoped_ptr<base::ListValue> encodings_list(new base::ListValue); |
47 for (std::vector<std::string>::const_iterator it = encodings_items.begin(); | 47 for (std::vector<std::string>::const_iterator it = encodings_items.begin(); |
48 it != encodings_items.end(); | 48 it != encodings_items.end(); |
49 ++it) { | 49 ++it) { |
50 encodings_list->AppendString(*it); | 50 encodings_list->AppendString(*it); |
51 } | 51 } |
52 value->Set(DefaultSearchManager::kInputEncodings, encodings_list.release()); | 52 value->Set(DefaultSearchManager::kInputEncodings, encodings_list.release()); |
53 | 53 |
54 scoped_ptr<base::ListValue> alternate_url_list(new base::ListValue()); | 54 scoped_ptr<base::ListValue> alternate_url_list(new base::ListValue()); |
55 if (!alternate_url.empty()) | 55 if (!alternate_url.empty()) |
56 alternate_url_list->Append(base::Value::CreateStringValue(alternate_url)); | 56 alternate_url_list->Append(new base::StringValue(alternate_url)); |
57 value->Set(DefaultSearchManager::kAlternateURLs, | 57 value->Set(DefaultSearchManager::kAlternateURLs, |
58 alternate_url_list.release()); | 58 alternate_url_list.release()); |
59 return value.Pass(); | 59 return value.Pass(); |
60 } | 60 } |
OLD | NEW |