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

Side by Side Diff: chrome/browser/autocomplete/extension_app_provider_unittest.cc

Issue 109013006: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 12 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 | Annotate | Revision Log
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/autocomplete/autocomplete_match.h" 8 #include "chrome/browser/autocomplete/autocomplete_match.h"
9 #include "chrome/browser/autocomplete/extension_app_provider.h" 9 #include "chrome/browser/autocomplete/extension_app_provider.h"
10 #include "chrome/browser/history/history_service.h" 10 #include "chrome/browser/history/history_service.h"
11 #include "chrome/browser/history/history_service_factory.h" 11 #include "chrome/browser/history/history_service_factory.h"
12 #include "chrome/browser/history/url_database.h" 12 #include "chrome/browser/history/url_database.h"
13 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
14 #include "content/public/test/test_browser_thread.h" 14 #include "content/public/test/test_browser_thread.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 using base::ASCIIToUTF16;
18
17 class ExtensionAppProviderTest : public testing::Test { 19 class ExtensionAppProviderTest : public testing::Test {
18 protected: 20 protected:
19 struct test_data { 21 struct test_data {
20 const base::string16 input; 22 const base::string16 input;
21 const size_t num_results; 23 const size_t num_results;
22 const GURL output[3]; 24 const GURL output[3];
23 }; 25 };
24 26
25 ExtensionAppProviderTest() 27 ExtensionAppProviderTest()
26 : ui_thread_(content::BrowserThread::UI, &message_loop_), 28 : ui_thread_(content::BrowserThread::UI, &message_loop_),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Populate the Extension Apps list. 70 // Populate the Extension Apps list.
69 ExtensionAppProvider::ExtensionApp extension_app = { 71 ExtensionAppProvider::ExtensionApp extension_app = {
70 ASCIIToUTF16(kExtensionApps[i].app_name), 72 ASCIIToUTF16(kExtensionApps[i].app_name),
71 ASCIIToUTF16(kExtensionApps[i].launch_url), 73 ASCIIToUTF16(kExtensionApps[i].launch_url),
72 kExtensionApps[i].should_match_against_launch_url 74 kExtensionApps[i].should_match_against_launch_url
73 }; 75 };
74 app_provider_->AddExtensionAppForTesting(extension_app); 76 app_provider_->AddExtensionAppForTesting(extension_app);
75 77
76 // Populate the InMemoryDatabase. 78 // Populate the InMemoryDatabase.
77 history::URLRow info(GURL(kExtensionApps[i].launch_url)); 79 history::URLRow info(GURL(kExtensionApps[i].launch_url));
78 info.set_title(UTF8ToUTF16(kExtensionApps[i].title)); 80 info.set_title(base::UTF8ToUTF16(kExtensionApps[i].title));
79 info.set_typed_count(kExtensionApps[i].typed_count); 81 info.set_typed_count(kExtensionApps[i].typed_count);
80 url_db->AddURL(info); 82 url_db->AddURL(info);
81 } 83 }
82 } 84 }
83 85
84 void ExtensionAppProviderTest::RunTest( 86 void ExtensionAppProviderTest::RunTest(
85 test_data* keyword_cases, 87 test_data* keyword_cases,
86 int num_cases) { 88 int num_cases) {
87 ACMatches matches; 89 ACMatches matches;
88 for (int i = 0; i < num_cases; ++i) { 90 for (int i = 0; i < num_cases; ++i) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 ExtensionAppProvider::ExtensionApp extension_app = 148 ExtensionAppProvider::ExtensionApp extension_app =
147 {ASCIIToUTF16(cases[i].name), url, true}; 149 {ASCIIToUTF16(cases[i].name), url, true};
148 AutocompleteMatch match = 150 AutocompleteMatch match =
149 app_provider_->CreateAutocompleteMatch(input, 151 app_provider_->CreateAutocompleteMatch(input,
150 extension_app, 152 extension_app,
151 0, 153 0,
152 base::string16::npos); 154 base::string16::npos);
153 EXPECT_EQ(ASCIIToUTF16(cases[i].match_contents), match.contents); 155 EXPECT_EQ(ASCIIToUTF16(cases[i].match_contents), match.contents);
154 } 156 }
155 } 157 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/extension_app_provider.cc ('k') | chrome/browser/autocomplete/history_quick_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698