| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/content_settings/host_content_settings_map.h" | 5 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 6 #include "chrome/browser/history/history_service_factory.h" | 6 #include "chrome/browser/history/history_service_factory.h" |
| 7 #include "chrome/browser/instant/instant_loader.h" | 7 #include "chrome/browser/instant/instant_loader.h" |
| 8 #include "chrome/browser/instant/instant_model_observer.h" | 8 #include "chrome/browser/instant/instant_model_observer.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/search_engines/template_url_service.h" | 10 #include "chrome/browser/search_engines/template_url_service.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SetupInstant() { | 72 void SetupInstant() { |
| 73 TemplateURLService* service = | 73 TemplateURLService* service = |
| 74 TemplateURLServiceFactory::GetForProfile(browser()->profile()); | 74 TemplateURLServiceFactory::GetForProfile(browser()->profile()); |
| 75 ui_test_utils::WaitForTemplateURLServiceToLoad(service); | 75 ui_test_utils::WaitForTemplateURLServiceToLoad(service); |
| 76 | 76 |
| 77 TemplateURLData data; | 77 TemplateURLData data; |
| 78 data.SetURL("http://does/not/exist?q={searchTerms}"); | 78 data.SetURL("http://does/not/exist?q={searchTerms}"); |
| 79 data.instant_url = instant_url_.spec(); | 79 data.instant_url = instant_url_.spec(); |
| 80 data.safe_for_autoreplace = true; |
| 80 | 81 |
| 81 TemplateURL* template_url = new TemplateURL(browser()->profile(), data); | 82 TemplateURL* template_url = new TemplateURL(browser()->profile(), data); |
| 82 service->Add(template_url); // Takes ownership of |template_url|. | 83 service->Add(template_url); // Takes ownership of |template_url|. |
| 83 service->SetDefaultSearchProvider(template_url); | 84 service->SetDefaultSearchProvider(template_url); |
| 84 | 85 |
| 85 browser()->profile()->GetPrefs()->SetBoolean(prefs::kInstantEnabled, true); | 86 browser()->profile()->GetPrefs()->SetBoolean(prefs::kInstantEnabled, true); |
| 86 } | 87 } |
| 87 | 88 |
| 88 InstantController* instant() { | 89 InstantController* instant() { |
| 89 return browser()->instant_controller()->instant(); | 90 return browser()->instant_controller()->instant(); |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 SetOmniboxTextAndWaitForInstantToShow("q"); | 1076 SetOmniboxTextAndWaitForInstantToShow("q"); |
| 1076 EXPECT_EQ(ASCIIToUTF16("query suggestion"), omnibox()->GetText()); | 1077 EXPECT_EQ(ASCIIToUTF16("query suggestion"), omnibox()->GetText()); |
| 1077 | 1078 |
| 1078 // Kill the instant renderer and wait for instant support again. | 1079 // Kill the instant renderer and wait for instant support again. |
| 1079 KillInstantRenderView(); | 1080 KillInstantRenderView(); |
| 1080 FocusOmniboxAndWaitForInstantSupport(); | 1081 FocusOmniboxAndWaitForInstantSupport(); |
| 1081 | 1082 |
| 1082 SetOmniboxTextAndWaitForInstantToShow("qu"); | 1083 SetOmniboxTextAndWaitForInstantToShow("qu"); |
| 1083 EXPECT_EQ(ASCIIToUTF16("query suggestion"), omnibox()->GetText()); | 1084 EXPECT_EQ(ASCIIToUTF16("query suggestion"), omnibox()->GetText()); |
| 1084 } | 1085 } |
| OLD | NEW |