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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 8 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
9 #include "chrome/browser/browser_list.h" | 9 #include "chrome/browser/browser_list.h" |
10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 ASSERT_FALSE(browser()->instant()->GetPreviewContents()); | 656 ASSERT_FALSE(browser()->instant()->GetPreviewContents()); |
657 ASSERT_FALSE(browser()->instant()->is_active()); | 657 ASSERT_FALSE(browser()->instant()->is_active()); |
658 TabContents* contents = browser()->GetSelectedTabContents(); | 658 TabContents* contents = browser()->GetSelectedTabContents(); |
659 ASSERT_TRUE(contents); | 659 ASSERT_TRUE(contents); |
660 | 660 |
661 // Check that the value is reflected and oncancel is called. | 661 // Check that the value is reflected and oncancel is called. |
662 EXPECT_EQ("true 0 1 1 1 a false abc false 3 3", | 662 EXPECT_EQ("true 0 1 1 1 a false abc false 3 3", |
663 GetSearchStateAsString(preview_)); | 663 GetSearchStateAsString(preview_)); |
664 } | 664 } |
665 | 665 |
666 #if !defined(OS_MACOSX) | 666 IN_PROC_BROWSER_TEST_F(InstantTest, TabKey) { |
667 // Only passes on Mac. http://crbug.com/66850 | |
668 #define MAYBE_TabKey FAILS_TabKey | |
669 #else | |
670 #define MAYBE_TabKey TabKey | |
671 #endif | |
672 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_TabKey) { | |
673 ASSERT_TRUE(test_server()->Start()); | 667 ASSERT_TRUE(test_server()->Start()); |
674 EnableInstant(); | 668 EnableInstant(); |
675 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); | 669 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); |
676 | 670 |
677 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 671 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
678 ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); | 672 ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); |
679 ASSERT_NO_FATAL_FAILURE(SetupPreview()); | 673 ASSERT_NO_FATAL_FAILURE(SetupPreview()); |
680 | 674 |
681 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"abc")); | 675 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"abc")); |
682 | 676 |
683 // Pressing tab to convert instant suggest into inline autocomplete. | 677 // Pressing tab to convert instant suggest into inline autocomplete. |
684 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB)); | 678 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB)); |
685 | 679 |
686 ASSERT_EQ(ASCIIToUTF16("abcdef"), location_bar_->location_entry()->GetText()); | 680 ASSERT_EQ(ASCIIToUTF16("abcdef"), location_bar_->location_entry()->GetText()); |
687 | 681 |
688 EXPECT_EQ("true 0 0 2 2 a false abcdef false 6 6", | 682 EXPECT_EQ("true 0 0 2 1 a false abcdef false 6 6", |
689 GetSearchStateAsString(preview_)); | 683 GetSearchStateAsString(preview_)); |
690 | 684 |
691 // Pressing tab again to accept the current instant preview. | 685 // Pressing tab again to accept the current instant preview. |
692 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB)); | 686 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB)); |
693 | 687 |
694 // Check that the preview contents have been committed. | 688 // Check that the preview contents have been committed. |
695 ASSERT_FALSE(browser()->instant()->GetPreviewContents()); | 689 ASSERT_FALSE(browser()->instant()->GetPreviewContents()); |
696 ASSERT_FALSE(browser()->instant()->is_active()); | 690 ASSERT_FALSE(browser()->instant()->is_active()); |
697 TabContents* contents = browser()->GetSelectedTabContents(); | 691 TabContents* contents = browser()->GetSelectedTabContents(); |
698 ASSERT_TRUE(contents); | 692 ASSERT_TRUE(contents); |
699 | 693 |
700 // Check that the value is reflected and onsubmit is called. | 694 // Check that the value is reflected and onsubmit is called. |
701 EXPECT_EQ("true 1 0 2 2 a false abcdef true 6 6", | 695 EXPECT_EQ("true 1 0 2 1 a false abcdef true 6 6", |
702 GetSearchStateAsString(preview_)); | 696 GetSearchStateAsString(preview_)); |
703 } | 697 } |
OLD | NEW |