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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 class MockInstantServiceObserver : public InstantServiceObserver { | 29 class MockInstantServiceObserver : public InstantServiceObserver { |
30 public: | 30 public: |
31 MOCK_METHOD0(DefaultSearchProviderChanged, void()); | 31 MOCK_METHOD0(DefaultSearchProviderChanged, void()); |
32 MOCK_METHOD0(GoogleURLUpdated, void()); | 32 MOCK_METHOD0(GoogleURLUpdated, void()); |
33 MOCK_METHOD1(OmniboxStartMarginChanged, void(int)); | 33 MOCK_METHOD1(OmniboxStartMarginChanged, void(int)); |
34 }; | 34 }; |
35 | 35 |
36 class InstantServiceTest : public InstantUnitTestBase { | 36 class InstantServiceTest : public InstantUnitTestBase { |
37 protected: | 37 protected: |
38 virtual void SetUp() OVERRIDE { | 38 virtual void SetUp() OVERRIDE { |
39 InstantUnitTestBase::SetUpWithoutCacheableNTP(); | 39 InstantUnitTestBase::SetUp(); |
40 | 40 |
41 instant_service_observer_.reset(new MockInstantServiceObserver()); | 41 instant_service_observer_.reset(new MockInstantServiceObserver()); |
42 instant_service_->AddObserver(instant_service_observer_.get()); | 42 instant_service_->AddObserver(instant_service_observer_.get()); |
43 } | 43 } |
44 | 44 |
45 virtual void TearDown() OVERRIDE { | 45 virtual void TearDown() OVERRIDE { |
46 instant_service_->RemoveObserver(instant_service_observer_.get()); | 46 instant_service_->RemoveObserver(instant_service_observer_.get()); |
47 InstantUnitTestBase::TearDown(); | 47 InstantUnitTestBase::TearDown(); |
48 } | 48 } |
49 | 49 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 NotifyGoogleBaseURLUpdate(new_base_url); | 142 NotifyGoogleBaseURLUpdate(new_base_url); |
143 EXPECT_NE(old_prerenderer, GetInstantSearchPrerenderer()); | 143 EXPECT_NE(old_prerenderer, GetInstantSearchPrerenderer()); |
144 } | 144 } |
145 | 145 |
146 TEST_F(InstantServiceTest, OmniboxStartMarginChanged) { | 146 TEST_F(InstantServiceTest, OmniboxStartMarginChanged) { |
147 int new_start_margin = 92; | 147 int new_start_margin = 92; |
148 EXPECT_CALL(*instant_service_observer_.get(), | 148 EXPECT_CALL(*instant_service_observer_.get(), |
149 OmniboxStartMarginChanged(new_start_margin)).Times(1); | 149 OmniboxStartMarginChanged(new_start_margin)).Times(1); |
150 UpdateOmniboxStartMargin(new_start_margin); | 150 UpdateOmniboxStartMargin(new_start_margin); |
151 } | 151 } |
OLD | NEW |