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.h" | |
8 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
9 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
10 #include "chrome/browser/browser_window.h" | 11 #include "chrome/browser/browser_window.h" |
11 #include "chrome/browser/instant/instant_controller.h" | 12 #include "chrome/browser/instant/instant_controller.h" |
12 #include "chrome/browser/instant/instant_loader.h" | 13 #include "chrome/browser/instant/instant_loader.h" |
13 #include "chrome/browser/instant/instant_loader_manager.h" | 14 #include "chrome/browser/instant/instant_loader_manager.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/search_engines/template_url.h" | 16 #include "chrome/browser/search_engines/template_url.h" |
16 #include "chrome/browser/search_engines/template_url_model.h" | 17 #include "chrome/browser/search_engines/template_url_model.h" |
17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 ASSERT_TRUE(test_server()->Start()); | 684 ASSERT_TRUE(test_server()->Start()); |
684 EnableInstant(); | 685 EnableInstant(); |
685 | 686 |
686 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 687 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
687 | 688 |
688 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(chrome::kAboutCrashURL)); | 689 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(chrome::kAboutCrashURL)); |
689 | 690 |
690 // If we get here it means the preview was shown. If we time out, it means the | 691 // If we get here it means the preview was shown. If we time out, it means the |
691 // preview was never shown. | 692 // preview was never shown. |
692 } | 693 } |
694 | |
695 IN_PROC_BROWSER_TEST_F(InstantTest, InstantCompleteNever) { | |
Peter Kasting
2011/03/29 00:10:27
Is testing INSTANT_COMPLETE_NOW what all the rest
sky
2011/03/29 00:11:20
Yes, since that's the default.
| |
696 ASSERT_TRUE(test_server()->Start()); | |
697 EnableInstant(); | |
698 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); | |
699 ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); | |
700 ASSERT_NO_FATAL_FAILURE(SetupPreview()); | |
701 | |
702 SetSuggestionsJavascriptArgument( | |
703 preview_, | |
704 "{suggestions:[{value:'defghij'}],complete_behavior:'never'}"); | |
705 ASSERT_NO_FATAL_FAILURE(SetLocationBarText("def")); | |
706 EXPECT_STR_EQ("defghij", GetSuggestion()); | |
707 AutocompleteEditModel* edit_model = location_bar_->location_entry()->model(); | |
708 EXPECT_EQ(INSTANT_COMPLETE_NEVER, edit_model->instant_complete_behavior()); | |
709 ASSERT_EQ(ASCIIToUTF16("def"), location_bar_->location_entry()->GetText()); | |
710 } | |
711 | |
712 IN_PROC_BROWSER_TEST_F(InstantTest, InstantCompleteDelayed) { | |
713 ASSERT_TRUE(test_server()->Start()); | |
714 EnableInstant(); | |
715 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); | |
716 ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); | |
717 ASSERT_NO_FATAL_FAILURE(SetupPreview()); | |
718 | |
719 SetSuggestionsJavascriptArgument( | |
720 preview_, | |
721 "{suggestions:[{value:'defghij'}],complete_behavior:'delayed'}"); | |
722 ASSERT_NO_FATAL_FAILURE(SetLocationBarText("def")); | |
723 EXPECT_STR_EQ("defghij", GetSuggestion()); | |
724 AutocompleteEditModel* edit_model = location_bar_->location_entry()->model(); | |
725 EXPECT_EQ(INSTANT_COMPLETE_DELAYED, edit_model->instant_complete_behavior()); | |
726 ASSERT_EQ(ASCIIToUTF16("def"), location_bar_->location_entry()->GetText()); | |
727 } | |
OLD | NEW |