| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // alternate nav URL would fail a DCHECK if the input began with "http://". | 371 // alternate nav URL would fail a DCHECK if the input began with "http://". |
| 372 // The failure was due to erroneously trying to strip the scheme from the | 372 // The failure was due to erroneously trying to strip the scheme from the |
| 373 // resulting fill_into_edit. Alternate nav matches are never shown, so there's | 373 // resulting fill_into_edit. Alternate nav matches are never shown, so there's |
| 374 // no need to ever try and strip this scheme. | 374 // no need to ever try and strip this scheme. |
| 375 TEST_F(OmniboxEditTest, AlternateNavHasHTTP) { | 375 TEST_F(OmniboxEditTest, AlternateNavHasHTTP) { |
| 376 const TestingOmniboxClient* client = | 376 const TestingOmniboxClient* client = |
| 377 static_cast<TestingOmniboxClient*>(model()->client()); | 377 static_cast<TestingOmniboxClient*>(model()->client()); |
| 378 const AutocompleteMatch match( | 378 const AutocompleteMatch match( |
| 379 model()->autocomplete_controller()->search_provider(), 0, false, | 379 model()->autocomplete_controller()->search_provider(), 0, false, |
| 380 AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED); | 380 AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED); |
| 381 const GURL alternate_nav_url("http://ab%20cd/"); | 381 const GURL alternate_nav_url("http://abcd/"); |
| 382 | 382 |
| 383 model()->OnSetFocus(false); // Avoids DCHECK in OpenMatch(). | 383 model()->OnSetFocus(false); // Avoids DCHECK in OpenMatch(). |
| 384 model()->SetUserText(base::ASCIIToUTF16("http://ab cd")); | 384 model()->SetUserText(base::ASCIIToUTF16("http://abcd")); |
| 385 model()->OpenMatch(match, WindowOpenDisposition::CURRENT_TAB, | 385 model()->OpenMatch(match, WindowOpenDisposition::CURRENT_TAB, |
| 386 alternate_nav_url, base::string16(), 0); | 386 alternate_nav_url, base::string16(), 0); |
| 387 EXPECT_TRUE(AutocompleteInput::HasHTTPScheme( | 387 EXPECT_TRUE(AutocompleteInput::HasHTTPScheme( |
| 388 client->alternate_nav_match().fill_into_edit)); | 388 client->alternate_nav_match().fill_into_edit)); |
| 389 | 389 |
| 390 model()->SetUserText(base::ASCIIToUTF16("ab cd")); | 390 model()->SetUserText(base::ASCIIToUTF16("abcd")); |
| 391 model()->OpenMatch(match, WindowOpenDisposition::CURRENT_TAB, | 391 model()->OpenMatch(match, WindowOpenDisposition::CURRENT_TAB, |
| 392 alternate_nav_url, base::string16(), 0); | 392 alternate_nav_url, base::string16(), 0); |
| 393 EXPECT_TRUE(AutocompleteInput::HasHTTPScheme( | 393 EXPECT_TRUE(AutocompleteInput::HasHTTPScheme( |
| 394 client->alternate_nav_match().fill_into_edit)); | 394 client->alternate_nav_match().fill_into_edit)); |
| 395 } | 395 } |
| OLD | NEW |