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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 } | 612 } |
613 | 613 |
614 // Makes sure that if the server doesn't support the instant API we don't show | 614 // Makes sure that if the server doesn't support the instant API we don't show |
615 // anything. | 615 // anything. |
616 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(SearchServerDoesntSupportInstant)) { | 616 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(SearchServerDoesntSupportInstant)) { |
617 ASSERT_TRUE(test_server()->Start()); | 617 ASSERT_TRUE(test_server()->Start()); |
618 EnableInstant(); | 618 EnableInstant(); |
619 SetupInstantProvider("empty.html"); | 619 SetupInstantProvider("empty.html"); |
620 | 620 |
621 ui_test_utils::WindowedNotificationObserver tab_closed_observer( | 621 ui_test_utils::WindowedNotificationObserver tab_closed_observer( |
622 content::NOTIFICATION_TAB_CLOSED, | 622 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
623 content::NotificationService::AllSources()); | 623 content::NotificationService::AllSources()); |
624 | 624 |
625 omnibox()->SetUserText(ASCIIToUTF16("d")); | 625 omnibox()->SetUserText(ASCIIToUTF16("d")); |
626 EXPECT_TRUE(preview()); | 626 EXPECT_TRUE(preview()); |
627 | 627 |
628 // When the response comes back that the page doesn't support instant the tab | 628 // When the response comes back that the page doesn't support instant the tab |
629 // should be closed. | 629 // should be closed. |
630 tab_closed_observer.Wait(); | 630 tab_closed_observer.Wait(); |
631 EXPECT_FALSE(preview()); | 631 EXPECT_FALSE(preview()); |
632 } | 632 } |
633 | 633 |
634 // Verifies transitioning from loading a non-search string to a search string | 634 // Verifies transitioning from loading a non-search string to a search string |
635 // with the provider not supporting instant works (meaning we don't display | 635 // with the provider not supporting instant works (meaning we don't display |
636 // anything). | 636 // anything). |
637 IN_PROC_BROWSER_TEST_F(InstantTest, | 637 IN_PROC_BROWSER_TEST_F(InstantTest, |
638 MAYBE(NonSearchToSearchDoesntSupportInstant)) { | 638 MAYBE(NonSearchToSearchDoesntSupportInstant)) { |
639 ASSERT_TRUE(test_server()->Start()); | 639 ASSERT_TRUE(test_server()->Start()); |
640 EnableInstant(); | 640 EnableInstant(); |
641 SetupInstantProvider("empty.html"); | 641 SetupInstantProvider("empty.html"); |
642 | 642 |
643 GURL url(test_server()->GetURL("files/empty.html")); | 643 GURL url(test_server()->GetURL("files/empty.html")); |
644 omnibox()->SetUserText(UTF8ToUTF16(url.spec())); | 644 omnibox()->SetUserText(UTF8ToUTF16(url.spec())); |
645 EXPECT_FALSE(preview()); | 645 EXPECT_FALSE(preview()); |
646 | 646 |
647 ui_test_utils::WindowedNotificationObserver tab_closed_observer( | 647 ui_test_utils::WindowedNotificationObserver tab_closed_observer( |
648 content::NOTIFICATION_TAB_CLOSED, | 648 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
649 content::NotificationService::AllSources()); | 649 content::NotificationService::AllSources()); |
650 | 650 |
651 // Now type in some search text. | 651 // Now type in some search text. |
652 omnibox()->SetUserText(ASCIIToUTF16("d")); | 652 omnibox()->SetUserText(ASCIIToUTF16("d")); |
653 EXPECT_TRUE(preview()); | 653 EXPECT_TRUE(preview()); |
654 | 654 |
655 // When the response comes back that the page doesn't support instant the tab | 655 // When the response comes back that the page doesn't support instant the tab |
656 // should be closed. | 656 // should be closed. |
657 tab_closed_observer.Wait(); | 657 tab_closed_observer.Wait(); |
658 EXPECT_FALSE(preview()); | 658 EXPECT_FALSE(preview()); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 // Press <Enter> in the omnibox, causing the preview to be committed. | 997 // Press <Enter> in the omnibox, causing the preview to be committed. |
998 WebContents* preview_tab = preview()->web_contents(); | 998 WebContents* preview_tab = preview()->web_contents(); |
999 ASSERT_TRUE(PressEnter()); | 999 ASSERT_TRUE(PressEnter()); |
1000 | 1000 |
1001 // The preview contents should now be the active tab contents. | 1001 // The preview contents should now be the active tab contents. |
1002 EXPECT_FALSE(preview()); | 1002 EXPECT_FALSE(preview()); |
1003 EXPECT_FALSE(instant()->is_displayable()); | 1003 EXPECT_FALSE(instant()->is_displayable()); |
1004 EXPECT_FALSE(instant()->IsCurrent()); | 1004 EXPECT_FALSE(instant()->IsCurrent()); |
1005 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); | 1005 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); |
1006 } | 1006 } |
OLD | NEW |