| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "chrome/browser/content_settings/host_content_settings_map.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 8 #include "chrome/browser/search/instant_service_factory.h" | 8 #include "chrome/browser/search/instant_service_factory.h" |
| 9 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
| 10 #include "chrome/browser/ui/search/instant_ntp.h" | 10 #include "chrome/browser/ui/search/instant_ntp.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 std::string test_instant_url_; | 115 std::string test_instant_url_; |
| 116 bool override_javascript_enabled_; | 116 bool override_javascript_enabled_; |
| 117 bool test_javascript_enabled_; | 117 bool test_javascript_enabled_; |
| 118 bool test_in_startup_; | 118 bool test_in_startup_; |
| 119 InstantNTP* test_ntp_; | 119 InstantNTP* test_ntp_; |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 class InstantNTPPrerendererTest : public testing::Test { | 122 class InstantNTPPrerendererTest : public testing::Test { |
| 123 public: | 123 public: |
| 124 virtual void SetUp() OVERRIDE { | 124 virtual void SetUp() OVERRIDE { |
| 125 chrome::EnableInstantExtendedAPIForTesting(); | |
| 126 instant_service_ = InstantServiceFactory::GetForProfile(&profile_); | 125 instant_service_ = InstantServiceFactory::GetForProfile(&profile_); |
| 127 instant_ntp_prerenderer_.reset( | 126 instant_ntp_prerenderer_.reset( |
| 128 new TestableInstantNTPPrerenderer(&profile_, instant_service_)); | 127 new TestableInstantNTPPrerenderer(&profile_, instant_service_)); |
| 129 } | 128 } |
| 130 | 129 |
| 131 virtual void TearDown() OVERRIDE { | 130 virtual void TearDown() OVERRIDE { |
| 132 instant_ntp_prerenderer_.reset(); | 131 instant_ntp_prerenderer_.reset(); |
| 133 } | 132 } |
| 134 | 133 |
| 135 TestableInstantNTPPrerenderer* instant_ntp_prerenderer() { | 134 TestableInstantNTPPrerenderer* instant_ntp_prerenderer() { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 268 |
| 270 TEST_F(InstantNTPPrerendererTest, IsJavascriptEnabledChecksPrefs) { | 269 TEST_F(InstantNTPPrerendererTest, IsJavascriptEnabledChecksPrefs) { |
| 271 instant_ntp_prerenderer()->set_override_javascript_enabled(false); | 270 instant_ntp_prerenderer()->set_override_javascript_enabled(false); |
| 272 instant_ntp_prerenderer()->profile()->GetPrefs()->SetBoolean( | 271 instant_ntp_prerenderer()->profile()->GetPrefs()->SetBoolean( |
| 273 prefs::kWebKitJavascriptEnabled, true); | 272 prefs::kWebKitJavascriptEnabled, true); |
| 274 EXPECT_TRUE(instant_ntp_prerenderer()->IsJavascriptEnabled()); | 273 EXPECT_TRUE(instant_ntp_prerenderer()->IsJavascriptEnabled()); |
| 275 instant_ntp_prerenderer()->profile()->GetPrefs()->SetBoolean( | 274 instant_ntp_prerenderer()->profile()->GetPrefs()->SetBoolean( |
| 276 prefs::kWebKitJavascriptEnabled, false); | 275 prefs::kWebKitJavascriptEnabled, false); |
| 277 EXPECT_FALSE(instant_ntp_prerenderer()->IsJavascriptEnabled()); | 276 EXPECT_FALSE(instant_ntp_prerenderer()->IsJavascriptEnabled()); |
| 278 } | 277 } |
| OLD | NEW |