| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/metrics/histogram_samples.h" | 8 #include "base/metrics/histogram_samples.h" |
| 9 #include "base/metrics/statistics_recorder.h" | 9 #include "base/metrics/statistics_recorder.h" |
| 10 #include "chrome/browser/ui/search/instant_controller.h" | 10 #include "chrome/browser/ui/search/instant_controller.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 std::string test_instant_url_; | 43 std::string test_instant_url_; |
| 44 bool test_supports_instant_; | 44 bool test_supports_instant_; |
| 45 bool test_is_local_; | 45 bool test_is_local_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 class TestableInstantController : public InstantController { | 48 class TestableInstantController : public InstantController { |
| 49 public: | 49 public: |
| 50 TestableInstantController() | 50 TestableInstantController() |
| 51 : InstantController(NULL, true), | 51 : InstantController(NULL, true), |
| 52 test_instant_url_("http://test_url"), | 52 test_instant_url_("http://test_url"), |
| 53 test_extended_enabled_(true), | 53 test_extended_enabled_(true) {} |
| 54 test_overlay_(NULL) { | |
| 55 } | |
| 56 | 54 |
| 57 // Overrides from InstantController | 55 // Overrides from InstantController |
| 58 virtual std::string GetInstantURL() const OVERRIDE { | 56 virtual std::string GetInstantURL() const OVERRIDE { |
| 59 return test_instant_url_; | 57 return test_instant_url_; |
| 60 } | 58 } |
| 61 | 59 |
| 62 virtual bool extended_enabled() const OVERRIDE { | 60 virtual bool extended_enabled() const OVERRIDE { |
| 63 return test_extended_enabled_; | 61 return test_extended_enabled_; |
| 64 } | 62 } |
| 65 | 63 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 instant_controller()->set_instant_url(instant_url); | 136 instant_controller()->set_instant_url(instant_url); |
| 139 test_overlay->set_supports_instant(false); | 137 test_overlay->set_supports_instant(false); |
| 140 fallback_reason = instant_controller()->ShouldSwitchToLocalOverlay(); | 138 fallback_reason = instant_controller()->ShouldSwitchToLocalOverlay(); |
| 141 ASSERT_EQ(fallback_reason, | 139 ASSERT_EQ(fallback_reason, |
| 142 InstantController::INSTANT_FALLBACK_INSTANT_NOT_SUPPORTED); | 140 InstantController::INSTANT_FALLBACK_INSTANT_NOT_SUPPORTED); |
| 143 | 141 |
| 144 test_overlay->set_supports_instant(true); | 142 test_overlay->set_supports_instant(true); |
| 145 fallback_reason = instant_controller()->ShouldSwitchToLocalOverlay(); | 143 fallback_reason = instant_controller()->ShouldSwitchToLocalOverlay(); |
| 146 ASSERT_EQ(fallback_reason, InstantController::INSTANT_FALLBACK_NONE); | 144 ASSERT_EQ(fallback_reason, InstantController::INSTANT_FALLBACK_NONE); |
| 147 } | 145 } |
| OLD | NEW |