| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Tests that http:// isn't inserted for an https url after the user nukes | 128 // Tests that http:// isn't inserted for an https url after the user nukes |
| 129 // https. | 129 // https. |
| 130 { "https://a.com/", 0, false, "a.com/", "a.com/", false, "" }, | 130 { "https://a.com/", 0, false, "a.com/", "a.com/", false, "" }, |
| 131 | 131 |
| 132 // Tests that http:// isn't inserted if the user adds to the host. | 132 // Tests that http:// isn't inserted if the user adds to the host. |
| 133 { "a.de/", 0, false, "a.de.com/", "a.de.com/", false, "" }, | 133 { "a.de/", 0, false, "a.de.com/", "a.de.com/", false, "" }, |
| 134 | 134 |
| 135 // Tests that we don't get double http if the user manually inserts http. | 135 // Tests that we don't get double http if the user manually inserts http. |
| 136 { "a.de/", 0, false, "http://a.de/", "http://a.de/", true, "http://a.de/" }, | 136 { "a.de/", 0, false, "http://a.de/", "http://a.de/", true, "http://a.de/" }, |
| 137 }; | 137 }; |
| 138 ScopedTestingBrowserProcess browser_process; | |
| 139 TestingOmniboxView view; | 138 TestingOmniboxView view; |
| 140 TestingAutocompleteEditController controller; | 139 TestingAutocompleteEditController controller; |
| 141 TestingProfile profile; | 140 TestingProfile profile; |
| 142 AutocompleteEditModel model(&view, &controller, &profile); | 141 AutocompleteEditModel model(&view, &controller, &profile); |
| 143 | 142 |
| 144 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) { | 143 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) { |
| 145 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text)); | 144 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text)); |
| 146 | 145 |
| 147 string16 result = ASCIIToUTF16(input[i].input); | 146 string16 result = ASCIIToUTF16(input[i].input); |
| 148 GURL url; | 147 GURL url; |
| 149 bool write_url; | 148 bool write_url; |
| 150 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, | 149 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, |
| 151 &result, &url, &write_url); | 150 &result, &url, &write_url); |
| 152 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; | 151 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; |
| 153 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; | 152 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; |
| 154 if (write_url) | 153 if (write_url) |
| 155 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; | 154 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; |
| 156 } | 155 } |
| 157 } | 156 } |
| OLD | NEW |