| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 std::string test_instant_url_; | 118 std::string test_instant_url_; |
| 119 bool override_javascript_enabled_; | 119 bool override_javascript_enabled_; |
| 120 bool test_javascript_enabled_; | 120 bool test_javascript_enabled_; |
| 121 bool test_in_startup_; | 121 bool test_in_startup_; |
| 122 InstantNTP* test_ntp_; | 122 InstantNTP* test_ntp_; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 class InstantNTPPrerendererTest : public testing::Test { | 125 class InstantNTPPrerendererTest : public testing::Test { |
| 126 public: | 126 public: |
| 127 virtual void SetUp() OVERRIDE { | 127 virtual void SetUp() OVERRIDE { |
| 128 chrome::EnableInstantExtendedAPIForTesting(); | |
| 129 instant_service_ = InstantServiceFactory::GetForProfile(&profile_); | 128 instant_service_ = InstantServiceFactory::GetForProfile(&profile_); |
| 130 instant_ntp_prerenderer_.reset( | 129 instant_ntp_prerenderer_.reset( |
| 131 new TestableInstantNTPPrerenderer(&profile_, instant_service_)); | 130 new TestableInstantNTPPrerenderer(&profile_, instant_service_)); |
| 132 } | 131 } |
| 133 | 132 |
| 134 virtual void TearDown() OVERRIDE { | 133 virtual void TearDown() OVERRIDE { |
| 135 instant_ntp_prerenderer_.reset(); | 134 instant_ntp_prerenderer_.reset(); |
| 136 } | 135 } |
| 137 | 136 |
| 138 TestableInstantNTPPrerenderer* instant_ntp_prerenderer() { | 137 TestableInstantNTPPrerenderer* instant_ntp_prerenderer() { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 236 |
| 238 TEST_F(InstantNTPPrerendererTest, IsJavascriptEnabledChecksPrefs) { | 237 TEST_F(InstantNTPPrerendererTest, IsJavascriptEnabledChecksPrefs) { |
| 239 instant_ntp_prerenderer()->set_override_javascript_enabled(false); | 238 instant_ntp_prerenderer()->set_override_javascript_enabled(false); |
| 240 instant_ntp_prerenderer()->profile()->GetPrefs()->SetBoolean( | 239 instant_ntp_prerenderer()->profile()->GetPrefs()->SetBoolean( |
| 241 prefs::kWebKitJavascriptEnabled, true); | 240 prefs::kWebKitJavascriptEnabled, true); |
| 242 EXPECT_TRUE(instant_ntp_prerenderer()->IsJavascriptEnabled()); | 241 EXPECT_TRUE(instant_ntp_prerenderer()->IsJavascriptEnabled()); |
| 243 instant_ntp_prerenderer()->profile()->GetPrefs()->SetBoolean( | 242 instant_ntp_prerenderer()->profile()->GetPrefs()->SetBoolean( |
| 244 prefs::kWebKitJavascriptEnabled, false); | 243 prefs::kWebKitJavascriptEnabled, false); |
| 245 EXPECT_FALSE(instant_ntp_prerenderer()->IsJavascriptEnabled()); | 244 EXPECT_FALSE(instant_ntp_prerenderer()->IsJavascriptEnabled()); |
| 246 } | 245 } |
| OLD | NEW |