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

Side by Side Diff: chrome/browser/instant/instant_browsertest.cc

Issue 6677030: Fixes crash if instant is enabled and you block JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds test Created 9 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/instant/instant_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h"
9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" 9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h"
10 #include "chrome/browser/browser_list.h" 10 #include "chrome/browser/browser_list.h"
11 #include "chrome/browser/browser_window.h" 11 #include "chrome/browser/browser_window.h"
12 #include "chrome/browser/content_settings/host_content_settings_map.h"
12 #include "chrome/browser/instant/instant_controller.h" 13 #include "chrome/browser/instant/instant_controller.h"
13 #include "chrome/browser/instant/instant_loader.h" 14 #include "chrome/browser/instant/instant_loader.h"
14 #include "chrome/browser/instant/instant_loader_manager.h" 15 #include "chrome/browser/instant/instant_loader_manager.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/search_engines/template_url.h" 17 #include "chrome/browser/search_engines/template_url.h"
17 #include "chrome/browser/search_engines/template_url_model.h" 18 #include "chrome/browser/search_engines/template_url_model.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/omnibox/location_bar.h" 20 #include "chrome/browser/ui/omnibox/location_bar.h"
20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
21 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 719
719 SetSuggestionsJavascriptArgument( 720 SetSuggestionsJavascriptArgument(
720 preview_, 721 preview_,
721 "{suggestions:[{value:'defghij'}],complete_behavior:'delayed'}"); 722 "{suggestions:[{value:'defghij'}],complete_behavior:'delayed'}");
722 ASSERT_NO_FATAL_FAILURE(SetLocationBarText("def")); 723 ASSERT_NO_FATAL_FAILURE(SetLocationBarText("def"));
723 EXPECT_STR_EQ("defghij", GetSuggestion()); 724 EXPECT_STR_EQ("defghij", GetSuggestion());
724 AutocompleteEditModel* edit_model = location_bar_->location_entry()->model(); 725 AutocompleteEditModel* edit_model = location_bar_->location_entry()->model();
725 EXPECT_EQ(INSTANT_COMPLETE_DELAYED, edit_model->instant_complete_behavior()); 726 EXPECT_EQ(INSTANT_COMPLETE_DELAYED, edit_model->instant_complete_behavior());
726 ASSERT_EQ(ASCIIToUTF16("def"), location_bar_->location_entry()->GetText()); 727 ASSERT_EQ(ASCIIToUTF16("def"), location_bar_->location_entry()->GetText());
727 } 728 }
729
730 // Make sure the renderer doesn't crash if javascript is blocked.
731 IN_PROC_BROWSER_TEST_F(InstantTest, DontCrashOnBlockedJS) {
732 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
733 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
734 ASSERT_TRUE(test_server()->Start());
735 EnableInstant();
736 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
737 ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
738 // Wait for notification that the instant API has been determined.
739 ui_test_utils::WaitForNotification(
740 NotificationType::INSTANT_SUPPORT_DETERMINED);
741 // As long as we get the notification we're good (the renderer didn't crash).
742 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/instant/instant_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698