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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_view_browsertest.cc

Issue 9264049: Allow SiteInstance for about:blank in new tab to be reused. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove logging statements. Created 8 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) 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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 // Test Enter to search. 592 // Test Enter to search.
593 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys)); 593 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys));
594 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 594 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
595 ASSERT_TRUE(popup_model->IsOpen()); 595 ASSERT_TRUE(popup_model->IsOpen());
596 596
597 // Check if the default match result is Search Primary Provider. 597 // Check if the default match result is Search Primary Provider.
598 ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, 598 ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED,
599 popup_model->result().default_match()->type); 599 popup_model->result().default_match()->type);
600 600
601 // Open the default match. 601 // Open the default match.
602 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, 0)); 602 {
603 ui_test_utils::WindowedNotificationObserver observer(
Peter Kasting 2012/02/06 18:35:53 Nit: Do we do this anywhere else in this file or o
Charlie Reis 2012/02/06 19:23:00 Good call. Turns out there's already a SendKeyAnd
604 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
605 content::Source<content::NavigationController>(
606 &browser()->GetSelectedWebContents()->GetController()));
607 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, 0));
608 observer.Wait();
609 }
603 GURL url = browser()->GetSelectedWebContents()->GetURL(); 610 GURL url = browser()->GetSelectedWebContents()->GetURL();
604 EXPECT_STREQ(kSearchTextURL, url.spec().c_str()); 611 EXPECT_STREQ(kSearchTextURL, url.spec().c_str());
605 612
606 // Test that entering a single character then Enter performs a search. 613 // Test that entering a single character then Enter performs a search.
607 browser()->FocusLocationBar(); 614 browser()->FocusLocationBar();
608 EXPECT_TRUE(omnibox_view->IsSelectAll()); 615 EXPECT_TRUE(omnibox_view->IsSelectAll());
609 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchSingleCharKeys)); 616 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchSingleCharKeys));
610 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 617 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
611 ASSERT_TRUE(popup_model->IsOpen()); 618 ASSERT_TRUE(popup_model->IsOpen());
612 EXPECT_EQ(kSearchSingleChar, UTF16ToUTF8(omnibox_view->GetText())); 619 EXPECT_EQ(kSearchSingleChar, UTF16ToUTF8(omnibox_view->GetText()));
613 620
614 // Check if the default match result is Search Primary Provider. 621 // Check if the default match result is Search Primary Provider.
615 ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, 622 ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED,
616 popup_model->result().default_match()->type); 623 popup_model->result().default_match()->type);
617 624
618 // Open the default match. 625 // Open the default match.
619 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, 0)); 626 {
627 ui_test_utils::WindowedNotificationObserver observer(
628 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
629 content::Source<content::NavigationController>(
630 &browser()->GetSelectedWebContents()->GetController()));
631 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, 0));
632 observer.Wait();
633 }
620 url = browser()->GetSelectedWebContents()->GetURL(); 634 url = browser()->GetSelectedWebContents()->GetURL();
621 EXPECT_STREQ(kSearchSingleCharURL, url.spec().c_str()); 635 EXPECT_STREQ(kSearchSingleCharURL, url.spec().c_str());
622 } 636 }
623 637
624 void EscapeToDefaultMatchTest() { 638 void EscapeToDefaultMatchTest() {
625 OmniboxView* omnibox_view = NULL; 639 OmniboxView* omnibox_view = NULL;
626 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 640 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
627 AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); 641 AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model();
628 ASSERT_TRUE(popup_model); 642 ASSERT_TRUE(popup_model);
629 643
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 } 1164 }
1151 1165
1152 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DesiredTLD) { 1166 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DesiredTLD) {
1153 DesiredTLDTest(); 1167 DesiredTLDTest();
1154 } 1168 }
1155 1169
1156 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, AltEnter) { 1170 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, AltEnter) {
1157 AltEnterTest(); 1171 AltEnterTest();
1158 } 1172 }
1159 1173
1160 // DISABLED http://crbug.com/80118
1161 #if defined(OS_LINUX)
1162 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DISABLED_EnterToSearch) {
1163 #else
1164 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EnterToSearch) { 1174 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EnterToSearch) {
1165 #endif // OS_LINUX
1166 EnterToSearchTest(); 1175 EnterToSearchTest();
1167 } 1176 }
1168 1177
1169 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscapeToDefaultMatch) { 1178 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscapeToDefaultMatch) {
1170 EscapeToDefaultMatchTest(); 1179 EscapeToDefaultMatchTest();
1171 } 1180 }
1172 1181
1173 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BasicTextOperations) { 1182 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BasicTextOperations) {
1174 BasicTextOperationsTest(); 1183 BasicTextOperationsTest();
1175 } 1184 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1336
1328 // Paste text. 1337 // Paste text.
1329 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, ui::EF_CONTROL_DOWN)); 1338 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, ui::EF_CONTROL_DOWN));
1330 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 1339 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
1331 ASSERT_TRUE(popup_model->IsOpen()); 1340 ASSERT_TRUE(popup_model->IsOpen());
1332 1341
1333 // Inline autocomplete shouldn't be triggered. 1342 // Inline autocomplete shouldn't be triggered.
1334 ASSERT_EQ(ASCIIToUTF16("abc"), omnibox_view->GetText()); 1343 ASSERT_EQ(ASCIIToUTF16("abc"), omnibox_view->GetText());
1335 } 1344 }
1336 #endif 1345 #endif
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc ('k') | content/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698