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

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

Issue 10006037: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compile Created 8 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/autocomplete/autocomplete_edit.h" 6 #include "chrome/browser/autocomplete/autocomplete_edit.h"
7 #include "chrome/browser/ui/omnibox/omnibox_view.h" 7 #include "chrome/browser/ui/omnibox/omnibox_view.h"
8 #include "chrome/browser/webdata/web_data_service_factory.h"
8 #include "chrome/test/base/testing_browser_process.h" 9 #include "chrome/test/base/testing_browser_process.h"
9 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
12 13
13 using content::WebContents; 14 using content::WebContents;
14 15
15 namespace { 16 namespace {
16 17
17 class TestingOmniboxView : public OmniboxView { 18 class TestingOmniboxView : public OmniboxView {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 150
150 // Makes sure intranet urls get 'http://' prefixed to them. 151 // Makes sure intranet urls get 'http://' prefixed to them.
151 { "b/foo", 0, true, "b/foo", "http://b/foo", true, "http://b/foo" }, 152 { "b/foo", 0, true, "b/foo", "http://b/foo", true, "http://b/foo" },
152 153
153 // Verifies a search term 'foo' doesn't end up with http. 154 // Verifies a search term 'foo' doesn't end up with http.
154 { "www.google.com/search?", 0, false, "foo", "foo", false, "" }, 155 { "www.google.com/search?", 0, false, "foo", "foo", false, "" },
155 }; 156 };
156 TestingOmniboxView view; 157 TestingOmniboxView view;
157 TestingAutocompleteEditController controller; 158 TestingAutocompleteEditController controller;
158 TestingProfile profile; 159 TestingProfile profile;
160 // WebDataService is not used in the test, but requires DB thread if
161 // instantiated.
162 WebDataServiceFactory::GetInstance()->SetTestingFactory(&profile, NULL);
159 profile.CreateTemplateURLService(); 163 profile.CreateTemplateURLService();
160 profile.CreateAutocompleteClassifier(); 164 profile.CreateAutocompleteClassifier();
161 AutocompleteEditModel model(&view, &controller, &profile); 165 AutocompleteEditModel model(&view, &controller, &profile);
162 166
163 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) { 167 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) {
164 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text)); 168 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text));
165 169
166 string16 result = ASCIIToUTF16(input[i].input); 170 string16 result = ASCIIToUTF16(input[i].input);
167 GURL url; 171 GURL url;
168 bool write_url; 172 bool write_url;
169 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, 173 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected,
170 &result, &url, &write_url); 174 &result, &url, &write_url);
171 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; 175 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i;
172 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; 176 EXPECT_EQ(input[i].write_url, write_url) << " @" << i;
173 if (write_url) 177 if (write_url)
174 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; 178 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i;
175 } 179 }
176 } 180 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698