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

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: Fix spacing. 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 559 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
560 AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); 560 AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model();
561 ASSERT_TRUE(popup_model); 561 ASSERT_TRUE(popup_model);
562 562
563 // Test ctrl-Enter. 563 // Test ctrl-Enter.
564 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kDesiredTLDKeys)); 564 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kDesiredTLDKeys));
565 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 565 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
566 ASSERT_TRUE(popup_model->IsOpen()); 566 ASSERT_TRUE(popup_model->IsOpen());
567 // ctrl-Enter triggers desired_tld feature, thus www.bar.com shall be 567 // ctrl-Enter triggers desired_tld feature, thus www.bar.com shall be
568 // opened. 568 // opened.
569 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, ui::EF_CONTROL_DOWN)); 569 ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, ui::EF_CONTROL_DOWN,
570 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
571 content::Source<content::NavigationController>(
572 &browser()->GetSelectedWebContents()->GetController())));
570 573
571 GURL url = browser()->GetSelectedWebContents()->GetURL(); 574 GURL url = browser()->GetSelectedWebContents()->GetURL();
572 EXPECT_STREQ(kDesiredTLDHostname, url.host().c_str()); 575 EXPECT_STREQ(kDesiredTLDHostname, url.host().c_str());
573 } 576 }
574 577
575 void AltEnterTest() { 578 void AltEnterTest() {
576 OmniboxView* omnibox_view = NULL; 579 OmniboxView* omnibox_view = NULL;
577 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 580 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
578 581
579 omnibox_view->SetUserText(ASCIIToUTF16(chrome::kChromeUIHistoryURL)); 582 omnibox_view->SetUserText(ASCIIToUTF16(chrome::kChromeUIHistoryURL));
(...skipping 12 matching lines...) Expand all
592 // Test Enter to search. 595 // Test Enter to search.
593 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys)); 596 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys));
594 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 597 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
595 ASSERT_TRUE(popup_model->IsOpen()); 598 ASSERT_TRUE(popup_model->IsOpen());
596 599
597 // Check if the default match result is Search Primary Provider. 600 // Check if the default match result is Search Primary Provider.
598 ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, 601 ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED,
599 popup_model->result().default_match()->type); 602 popup_model->result().default_match()->type);
600 603
601 // Open the default match. 604 // Open the default match.
602 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, 0)); 605 ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, 0,
606 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
607 content::Source<content::NavigationController>(
608 &browser()->GetSelectedWebContents()->GetController())));
603 GURL url = browser()->GetSelectedWebContents()->GetURL(); 609 GURL url = browser()->GetSelectedWebContents()->GetURL();
604 EXPECT_STREQ(kSearchTextURL, url.spec().c_str()); 610 EXPECT_STREQ(kSearchTextURL, url.spec().c_str());
605 611
606 // Test that entering a single character then Enter performs a search. 612 // Test that entering a single character then Enter performs a search.
607 browser()->FocusLocationBar(); 613 browser()->FocusLocationBar();
608 EXPECT_TRUE(omnibox_view->IsSelectAll()); 614 EXPECT_TRUE(omnibox_view->IsSelectAll());
609 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchSingleCharKeys)); 615 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchSingleCharKeys));
610 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 616 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
611 ASSERT_TRUE(popup_model->IsOpen()); 617 ASSERT_TRUE(popup_model->IsOpen());
612 EXPECT_EQ(kSearchSingleChar, UTF16ToUTF8(omnibox_view->GetText())); 618 EXPECT_EQ(kSearchSingleChar, UTF16ToUTF8(omnibox_view->GetText()));
613 619
614 // Check if the default match result is Search Primary Provider. 620 // Check if the default match result is Search Primary Provider.
615 ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, 621 ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED,
616 popup_model->result().default_match()->type); 622 popup_model->result().default_match()->type);
617 623
618 // Open the default match. 624 // Open the default match.
619 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, 0)); 625 ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, 0,
626 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
627 content::Source<content::NavigationController>(
628 &browser()->GetSelectedWebContents()->GetController())));
620 url = browser()->GetSelectedWebContents()->GetURL(); 629 url = browser()->GetSelectedWebContents()->GetURL();
621 EXPECT_STREQ(kSearchSingleCharURL, url.spec().c_str()); 630 EXPECT_STREQ(kSearchSingleCharURL, url.spec().c_str());
622 } 631 }
623 632
624 void EscapeToDefaultMatchTest() { 633 void EscapeToDefaultMatchTest() {
625 OmniboxView* omnibox_view = NULL; 634 OmniboxView* omnibox_view = NULL;
626 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 635 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
627 AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); 636 AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model();
628 ASSERT_TRUE(popup_model); 637 ASSERT_TRUE(popup_model);
629 638
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 } 1159 }
1151 1160
1152 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DesiredTLD) { 1161 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DesiredTLD) {
1153 DesiredTLDTest(); 1162 DesiredTLDTest();
1154 } 1163 }
1155 1164
1156 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, AltEnter) { 1165 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, AltEnter) {
1157 AltEnterTest(); 1166 AltEnterTest();
1158 } 1167 }
1159 1168
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) { 1169 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EnterToSearch) {
1165 #endif // OS_LINUX
1166 EnterToSearchTest(); 1170 EnterToSearchTest();
1167 } 1171 }
1168 1172
1169 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscapeToDefaultMatch) { 1173 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscapeToDefaultMatch) {
1170 EscapeToDefaultMatchTest(); 1174 EscapeToDefaultMatchTest();
1171 } 1175 }
1172 1176
1173 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BasicTextOperations) { 1177 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BasicTextOperations) {
1174 BasicTextOperationsTest(); 1178 BasicTextOperationsTest();
1175 } 1179 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1331
1328 // Paste text. 1332 // Paste text.
1329 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, ui::EF_CONTROL_DOWN)); 1333 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, ui::EF_CONTROL_DOWN));
1330 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 1334 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
1331 ASSERT_TRUE(popup_model->IsOpen()); 1335 ASSERT_TRUE(popup_model->IsOpen());
1332 1336
1333 // Inline autocomplete shouldn't be triggered. 1337 // Inline autocomplete shouldn't be triggered.
1334 ASSERT_EQ(ASCIIToUTF16("abc"), omnibox_view->GetText()); 1338 ASSERT_EQ(ASCIIToUTF16("abc"), omnibox_view->GetText());
1335 } 1339 }
1336 #endif 1340 #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