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

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

Issue 6478005: GTTF: Use a fresh TestingBrowserProcess for each test, part #1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make more tests use the new base class Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/autocomplete/autocomplete_edit_view.h" 7 #include "chrome/browser/autocomplete/autocomplete_edit_view.h"
8 #include "chrome/test/testing_browser_process.h"
8 #include "chrome/test/testing_profile.h" 9 #include "chrome/test/testing_profile.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 namespace { 13 namespace {
13 14
14 class TestingAutocompleteEditView : public AutocompleteEditView { 15 class TestingAutocompleteEditView : public AutocompleteEditView {
15 public: 16 public:
16 TestingAutocompleteEditView() {} 17 TestingAutocompleteEditView() {}
17 18
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // Tests that http:// isn't inserted for an https url after the user nukes 134 // Tests that http:// isn't inserted for an https url after the user nukes
134 // https. 135 // https.
135 { "https://a.com/", 0, false, "a.com/", "a.com/", false, "" }, 136 { "https://a.com/", 0, false, "a.com/", "a.com/", false, "" },
136 137
137 // Tests that http:// isn't inserted if the user adds to the host. 138 // Tests that http:// isn't inserted if the user adds to the host.
138 { "a.b/", 0, false, "a.bc/", "a.bc/", false, "" }, 139 { "a.b/", 0, false, "a.bc/", "a.bc/", false, "" },
139 140
140 // Tests that we don't get double http if the user manually inserts http. 141 // Tests that we don't get double http if the user manually inserts http.
141 { "a.b/", 0, false, "http://a.b/", "http://a.b/", true, "http://a.b/" }, 142 { "a.b/", 0, false, "http://a.b/", "http://a.b/", true, "http://a.b/" },
142 }; 143 };
144 ScopedTestingBrowserProcess browser_process;
143 TestingAutocompleteEditView view; 145 TestingAutocompleteEditView view;
144 TestingAutocompleteEditController controller; 146 TestingAutocompleteEditController controller;
145 TestingProfile profile; 147 TestingProfile profile;
146 AutocompleteEditModel model(&view, &controller, &profile); 148 AutocompleteEditModel model(&view, &controller, &profile);
147 149
148 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) { 150 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) {
149 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text)); 151 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text));
150 152
151 string16 result = ASCIIToUTF16(input[i].input); 153 string16 result = ASCIIToUTF16(input[i].input);
152 GURL url; 154 GURL url;
153 bool write_url; 155 bool write_url;
154 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, 156 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected,
155 &result, &url, &write_url); 157 &result, &url, &write_url);
156 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; 158 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i;
157 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; 159 EXPECT_EQ(input[i].write_url, write_url) << " @" << i;
158 if (write_url) 160 if (write_url)
159 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; 161 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i;
160 } 162 }
161 } 163 }
OLDNEW
« no previous file with comments | « chrome/browser/appcache/chrome_appcache_service_unittest.cc ('k') | chrome/browser/autocomplete/autocomplete_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698