| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test/base/testing_browser_process.h" | 8 #include "chrome/test/base/testing_browser_process.h" |
| 9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 // Makes sure intranet urls get 'http://' prefixed to them. | 149 // Makes sure intranet urls get 'http://' prefixed to them. |
| 150 { "b/foo", 0, true, "b/foo", "http://b/foo", true, "http://b/foo" }, | 150 { "b/foo", 0, true, "b/foo", "http://b/foo", true, "http://b/foo" }, |
| 151 | 151 |
| 152 // Verifies a search term 'foo' doesn't end up with http. | 152 // Verifies a search term 'foo' doesn't end up with http. |
| 153 { "www.google.com/search?", 0, false, "foo", "foo", false, "" }, | 153 { "www.google.com/search?", 0, false, "foo", "foo", false, "" }, |
| 154 }; | 154 }; |
| 155 TestingOmniboxView view; | 155 TestingOmniboxView view; |
| 156 TestingAutocompleteEditController controller; | 156 TestingAutocompleteEditController controller; |
| 157 TestingProfile profile; | 157 TestingProfile profile; |
| 158 profile.CreateTemplateURLService(); |
| 159 profile.CreateAutocompleteClassifier(); |
| 158 AutocompleteEditModel model(&view, &controller, &profile); | 160 AutocompleteEditModel model(&view, &controller, &profile); |
| 159 profile.CreateAutocompleteClassifier(); | |
| 160 profile.CreateTemplateURLService(); | |
| 161 | 161 |
| 162 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) { | 162 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) { |
| 163 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text)); | 163 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text)); |
| 164 | 164 |
| 165 string16 result = ASCIIToUTF16(input[i].input); | 165 string16 result = ASCIIToUTF16(input[i].input); |
| 166 GURL url; | 166 GURL url; |
| 167 bool write_url; | 167 bool write_url; |
| 168 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, | 168 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, |
| 169 &result, &url, &write_url); | 169 &result, &url, &write_url); |
| 170 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; | 170 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; |
| 171 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; | 171 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; |
| 172 if (write_url) | 172 if (write_url) |
| 173 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; | 173 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; |
| 174 } | 174 } |
| 175 } | 175 } |
| OLD | NEW |