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

Side by Side Diff: chrome/browser/search/instant_service_unittest.cc

Issue 2290503003: Remove use of stl_util in search_engines. (Closed)
Patch Set: fix broken test Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/search/instant_service.h" 5 #include "chrome/browser/search/instant_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <tuple> 9 #include <tuple>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/ptr_util.h"
12 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/browser/search/instant_service_observer.h" 16 #include "chrome/browser/search/instant_service_observer.h"
16 #include "chrome/browser/search/instant_unittest_base.h" 17 #include "chrome/browser/search/instant_unittest_base.h"
17 #include "chrome/browser/search/search.h" 18 #include "chrome/browser/search/search.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/search/instant_search_prerenderer.h" 21 #include "chrome/browser/ui/search/instant_search_prerenderer.h"
21 #include "chrome/common/render_messages.h" 22 #include "chrome/common/render_messages.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 125
125 TEST_F(InstantServiceEnabledTest, 126 TEST_F(InstantServiceEnabledTest,
126 ResetInstantSearchPrerenderer_DefaultProviderChanged) { 127 ResetInstantSearchPrerenderer_DefaultProviderChanged) {
127 EXPECT_CALL(*instant_service_observer_.get(), 128 EXPECT_CALL(*instant_service_observer_.get(),
128 DefaultSearchProviderChanged(false)).Times(2); 129 DefaultSearchProviderChanged(false)).Times(2);
129 130
130 // Set a default search provider that doesn't support Instant. 131 // Set a default search provider that doesn't support Instant.
131 TemplateURLData data; 132 TemplateURLData data;
132 data.SetShortName(base::ASCIIToUTF16("foobar.com")); 133 data.SetShortName(base::ASCIIToUTF16("foobar.com"));
133 data.SetURL("https://foobar.com/url?bar={searchTerms}"); 134 data.SetURL("https://foobar.com/url?bar={searchTerms}");
134 TemplateURL* template_url = new TemplateURL(data); 135 TemplateURL* template_url =
135 // Takes ownership of |template_url|. 136 template_url_service_->Add(base::MakeUnique<TemplateURL>(data));
136 template_url_service_->Add(template_url);
137 template_url_service_->SetUserSelectedDefaultSearchProvider(template_url); 137 template_url_service_->SetUserSelectedDefaultSearchProvider(template_url);
138 138
139 EXPECT_EQ(static_cast<InstantSearchPrerenderer*>(NULL), 139 EXPECT_EQ(static_cast<InstantSearchPrerenderer*>(NULL),
140 GetInstantSearchPrerenderer()); 140 GetInstantSearchPrerenderer());
141 141
142 // Set a default search provider that supports Instant and make sure 142 // Set a default search provider that supports Instant and make sure
143 // InstantSearchPrerenderer is valid. 143 // InstantSearchPrerenderer is valid.
144 SetUserSelectedDefaultSearchProvider("https://google.com/"); 144 SetUserSelectedDefaultSearchProvider("https://google.com/");
145 EXPECT_NE(static_cast<InstantSearchPrerenderer*>(NULL), 145 EXPECT_NE(static_cast<InstantSearchPrerenderer*>(NULL),
146 GetInstantSearchPrerenderer()); 146 GetInstantSearchPrerenderer());
(...skipping 15 matching lines...) Expand all
162 TEST_F(InstantServiceTest, GetSuggestionFromClientSide) { 162 TEST_F(InstantServiceTest, GetSuggestionFromClientSide) {
163 history::MostVisitedURLList url_list; 163 history::MostVisitedURLList url_list;
164 url_list.push_back(history::MostVisitedURL()); 164 url_list.push_back(history::MostVisitedURL());
165 165
166 instant_service_->OnMostVisitedItemsReceived(url_list); 166 instant_service_->OnMostVisitedItemsReceived(url_list);
167 167
168 auto items = instant_service_->most_visited_items_; 168 auto items = instant_service_->most_visited_items_;
169 ASSERT_EQ(1, (int)items.size()); 169 ASSERT_EQ(1, (int)items.size());
170 ASSERT_FALSE(items[0].is_server_side_suggestion); 170 ASSERT_FALSE(items[0].is_server_side_suggestion);
171 } 171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698