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

Side by Side Diff: chrome/browser/search_engines/template_url_fetcher_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/template_url_fetcher.h" 5 #include "components/search_engines/template_url_fetcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/callback_helpers.h" 13 #include "base/callback_helpers.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ptr_util.h"
16 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
17 #include "base/path_service.h" 18 #include "base/path_service.h"
18 #include "base/run_loop.h" 19 #include "base/run_loop.h"
19 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
20 #include "chrome/browser/search_engines/template_url_service_test_util.h" 21 #include "chrome/browser/search_engines/template_url_service_test_util.h"
21 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
22 #include "components/search_engines/template_url.h" 23 #include "components/search_engines/template_url.h"
23 #include "components/search_engines/template_url_service.h" 24 #include "components/search_engines/template_url_service.h"
24 #include "content/public/test/test_browser_thread_bundle.h" 25 #include "content/public/test/test_browser_thread_bundle.h"
25 #include "net/test/embedded_test_server/embedded_test_server.h" 26 #include "net/test/embedded_test_server/embedded_test_server.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 EXPECT_EQ(0, template_url_fetcher()->requests_count()); 223 EXPECT_EQ(0, template_url_fetcher()->requests_count());
223 EXPECT_EQ(0, requests_completed()); 224 EXPECT_EQ(0, requests_completed());
224 } 225 }
225 226
226 TEST_F(TemplateURLFetcherTest, DuplicateKeywordsTest) { 227 TEST_F(TemplateURLFetcherTest, DuplicateKeywordsTest) {
227 base::string16 keyword(ASCIIToUTF16("test")); 228 base::string16 keyword(ASCIIToUTF16("test"));
228 TemplateURLData data; 229 TemplateURLData data;
229 data.SetShortName(keyword); 230 data.SetShortName(keyword);
230 data.SetKeyword(keyword); 231 data.SetKeyword(keyword);
231 data.SetURL("http://example.com/"); 232 data.SetURL("http://example.com/");
232 test_util()->model()->Add(new TemplateURL(data)); 233 test_util()->model()->Add(base::MakeUnique<TemplateURL>(data));
233 test_util()->ChangeModelToLoadState(); 234 test_util()->ChangeModelToLoadState();
234 235
235 EXPECT_TRUE(test_util()->model()->GetTemplateURLForKeyword(keyword)); 236 EXPECT_TRUE(test_util()->model()->GetTemplateURLForKeyword(keyword));
236 237
237 // This should bail because the keyword already exists. 238 // This should bail because the keyword already exists.
238 std::string osdd_file_name("simple_open_search.xml"); 239 std::string osdd_file_name("simple_open_search.xml");
239 StartDownload(keyword, osdd_file_name, true); 240 StartDownload(keyword, osdd_file_name, true);
240 EXPECT_EQ(0, template_url_fetcher()->requests_count()); 241 EXPECT_EQ(0, template_url_fetcher()->requests_count());
241 EXPECT_EQ(0, requests_completed()); 242 EXPECT_EQ(0, requests_completed());
242 } 243 }
(...skipping 25 matching lines...) Expand all
268 std::string osdd_file_name("unicode_open_search.xml"); 269 std::string osdd_file_name("unicode_open_search.xml");
269 StartDownload(keyword, osdd_file_name, true); 270 StartDownload(keyword, osdd_file_name, true);
270 WaitForDownloadToFinish(); 271 WaitForDownloadToFinish();
271 const TemplateURL* t_url = 272 const TemplateURL* t_url =
272 test_util()->model()->GetTemplateURLForKeyword(keyword); 273 test_util()->model()->GetTemplateURLForKeyword(keyword);
273 EXPECT_EQ(base::UTF8ToUTF16("\xd1\x82\xd0\xb5\xd1\x81\xd1\x82"), 274 EXPECT_EQ(base::UTF8ToUTF16("\xd1\x82\xd0\xb5\xd1\x81\xd1\x82"),
274 t_url->short_name()); 275 t_url->short_name());
275 } 276 }
276 277
277 } // namespace 278 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698