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

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

Issue 1598553003: Implement the Windows desktop search redirection feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build errors due to prefs being moved in components Created 4 years, 10 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
(Empty)
1 // Copyright 2015 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/detect_desktop_search_win.h"
6
7 #include <stddef.h>
8
9 #include "base/macros.h"
10 #include "base/strings/string16.h"
11 #include "components/search_engines/testing_search_terms_data.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "url/gurl.h"
14
15 namespace {
16 struct DetectWindowsDesktopSearchTestData {
17 const char* url;
18 const wchar_t* expected_search_terms;
19 };
20 } // namespace
21
22 TEST(DetectWindowsDesktopSearch, DetectWindowsDesktopSearch) {
23 const DetectWindowsDesktopSearchTestData test_data[] = {
24 {"https://www.google.com", L""},
25 {"https://www.bing.com/search", L""},
26 {"https://www.bing.com/search?q=keyword&form=QBLH", L""},
27 {"https://www.bing.com/search?q=keyword&form=WNSGPH", L"keyword"},
28 {"https://www.bing.com/search?q=keyword&form=WNSBOX", L"keyword"},
29 {"https://www.bing.com/search?q=keyword&FORM=WNSGPH", L"keyword"},
30 {"https://www.bing.com/search?q=keyword&FORM=WNSBOX", L"keyword"},
31 {"https://www.bing.com/search?form=WNSGPH&q=keyword", L"keyword"},
32 {"https://www.bing.com/search?q=keyword&form=WNSGPH&other=stuff",
33 L"keyword"},
34 {"https://www.bing.com/search?q=%C3%A8+%C3%A9&form=WNSGPH", L"\xE8 \xE9"},
35 };
36
37 for (size_t i = 0; i < arraysize(test_data); ++i) {
38 TestingSearchTermsData search_terms_data("https://www.google.com");
39 base::string16 search_terms;
40 bool is_desktop_search = DetectWindowsDesktopSearch(
41 GURL(test_data[i].url), search_terms_data, &search_terms);
42 const base::string16 expected_search_terms(
43 test_data[i].expected_search_terms);
44 EXPECT_EQ(!expected_search_terms.empty(), is_desktop_search);
45 EXPECT_EQ(expected_search_terms, search_terms);
46 }
47 }
OLDNEW
« no previous file with comments | « components/search_engines/desktop_search_win_unittest.cc ('k') | components/search_engines_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698