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

Side by Side Diff: components/search_engines/search_engines_test_util.cc

Issue 2479113002: Make extensions DSE persistent in browser prefs (Closed)
Patch Set: Tests updated(rewritten) after review Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/search_engines/search_engines_test_util.h"
6
7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h"
9 #include "base/strings/string_split.h"
vasilii 2016/12/06 19:16:42 unused?
Alexander Yashkin 2016/12/09 08:19:52 You are right, deleted
10 #include "base/strings/utf_string_conversions.h"
11 #include "components/policy/core/common/policy_types.h"
12 #include "components/policy/policy_constants.h"
vasilii 2016/12/06 19:16:42 Obsolete includes?
Alexander Yashkin 2016/12/09 08:19:52 Deleted
13 #include "components/search_engines/template_url.h"
14 #include "components/search_engines/template_url_data.h"
15 #include "testing/gtest/include/gtest/gtest.h"
16
17 std::unique_ptr<TemplateURLData> GenerateDummyTemplateURLData(
18 const std::string& provider_name) {
19 std::unique_ptr<TemplateURLData> data(new TemplateURLData());
20 data->SetShortName(
21 base::UTF8ToUTF16(std::string(provider_name).append("name")));
22 data->SetKeyword(base::UTF8ToUTF16(std::string(provider_name).append("key")));
23 data->SetURL(
24 std::string("http://").append(provider_name).append("foo/{searchTerms}"));
25 data->suggestions_url =
26 std::string("http://").append(provider_name).append("sugg");
27 data->alternate_urls.push_back(
28 std::string("http://").append(provider_name).append("foo/alt"));
29 data->favicon_url = GURL("http://icon1");
30 data->safe_for_autoreplace = true;
31 data->input_encodings = {"UTF-8", "UTF-16"};
32 data->date_created = base::Time();
33 data->last_modified = base::Time();
34 return data;
35 }
36
37 void ExpectSimilar(const TemplateURLData* expected,
38 const TemplateURLData* actual) {
39 ASSERT_TRUE(expected != NULL);
40 ASSERT_TRUE(actual != NULL);
41
42 EXPECT_EQ(expected->short_name(), actual->short_name());
43 EXPECT_EQ(expected->keyword(), actual->keyword());
44 EXPECT_EQ(expected->url(), actual->url());
45 EXPECT_EQ(expected->suggestions_url, actual->suggestions_url);
46 EXPECT_EQ(expected->instant_url, actual->instant_url);
47 EXPECT_EQ(expected->image_url, actual->image_url);
48 EXPECT_EQ(expected->new_tab_url, actual->new_tab_url);
49 EXPECT_EQ(expected->contextual_search_url, actual->contextual_search_url);
50
51 EXPECT_EQ(expected->search_url_post_params, actual->search_url_post_params);
52 EXPECT_EQ(expected->suggestions_url_post_params,
53 actual->suggestions_url_post_params);
54 EXPECT_EQ(expected->instant_url_post_params, actual->instant_url_post_params);
55 EXPECT_EQ(expected->image_url_post_params, actual->image_url_post_params);
56
57 EXPECT_EQ(expected->favicon_url, actual->favicon_url);
58 EXPECT_EQ(expected->safe_for_autoreplace, actual->safe_for_autoreplace);
59 EXPECT_EQ(expected->input_encodings, actual->input_encodings);
60 EXPECT_EQ(expected->alternate_urls, actual->alternate_urls);
61 EXPECT_TRUE(TemplateURL::SearchTermsReplacementKeysMatch(
62 expected->search_terms_replacement_key,
63 actual->search_terms_replacement_key));
64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698