Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chrome/browser/ui/search/search_model_unittest.cc

Issue 2888553002: Instant: small cleanups (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/search/search_model.cc ('k') | chrome/common/search/search_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/ui/search/search_model.h" 5 #include "chrome/browser/ui/search/search_model.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/ui/search/search_model_observer.h" 9 #include "chrome/browser/ui/search/search_model_observer.h"
10 #include "chrome/browser/ui/search/search_tab_helper.h" 10 #include "chrome/browser/ui/search/search_tab_helper.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 model->AddObserver(&mock_observer); 84 model->AddObserver(&mock_observer);
85 } 85 }
86 86
87 void SearchModelTest::TearDown() { 87 void SearchModelTest::TearDown() {
88 model->RemoveObserver(&mock_observer); 88 model->RemoveObserver(&mock_observer);
89 ChromeRenderViewHostTestHarness::TearDown(); 89 ChromeRenderViewHostTestHarness::TearDown();
90 } 90 }
91 91
92 TEST_F(SearchModelTest, UpdateSearchModelInstantSupport) { 92 TEST_F(SearchModelTest, UpdateSearchModelInstantSupport) {
93 mock_observer.VerifyNotificationCount(0); 93 mock_observer.VerifyNotificationCount(0);
94 EXPECT_TRUE(model->instant_support() == INSTANT_SUPPORT_UNKNOWN); 94 EXPECT_TRUE(model->instant_support() == INSTANT_SUPPORT_NO);
95 SearchModel::State expected_old_state = model->state(); 95 SearchModel::State expected_old_state = model->state();
96 SearchModel::State expected_new_state(model->state()); 96 SearchModel::State expected_new_state(model->state());
97 expected_new_state.instant_support = INSTANT_SUPPORT_YES; 97 expected_new_state.instant_support = INSTANT_SUPPORT_YES;
98 98
99 model->SetInstantSupportState(INSTANT_SUPPORT_YES); 99 model->SetInstantSupportState(INSTANT_SUPPORT_YES);
100 mock_observer.VerifySearchModelStates(expected_old_state, expected_new_state); 100 mock_observer.VerifySearchModelStates(expected_old_state, expected_new_state);
101 mock_observer.VerifyNotificationCount(1); 101 mock_observer.VerifyNotificationCount(1);
102 EXPECT_TRUE(model->instant_support() == INSTANT_SUPPORT_YES); 102 EXPECT_TRUE(model->instant_support() == INSTANT_SUPPORT_YES);
103 103
104 expected_old_state = expected_new_state; 104 expected_old_state = expected_new_state;
(...skipping 24 matching lines...) Expand all
129 expected_old_state = expected_new_state; 129 expected_old_state = expected_new_state;
130 expected_new_state.mode = search_mode; 130 expected_new_state.mode = search_mode;
131 model->SetMode(search_mode); 131 model->SetMode(search_mode);
132 mock_observer.VerifySearchModelStates(expected_old_state, expected_new_state); 132 mock_observer.VerifySearchModelStates(expected_old_state, expected_new_state);
133 mock_observer.VerifyNotificationCount(2); 133 mock_observer.VerifyNotificationCount(2);
134 EXPECT_TRUE(model->state() == expected_new_state); 134 EXPECT_TRUE(model->state() == expected_new_state);
135 } 135 }
136 136
137 TEST_F(SearchModelTest, UpdateSearchModelState) { 137 TEST_F(SearchModelTest, UpdateSearchModelState) {
138 SearchModel::State expected_new_state(model->state()); 138 SearchModel::State expected_new_state(model->state());
139 expected_new_state.instant_support = INSTANT_SUPPORT_NO; 139 expected_new_state.instant_support = INSTANT_SUPPORT_YES;
140 EXPECT_FALSE(model->state() == expected_new_state); 140 EXPECT_FALSE(model->state() == expected_new_state);
141 model->SetState(expected_new_state); 141 model->SetState(expected_new_state);
142 mock_observer.VerifyNotificationCount(1); 142 mock_observer.VerifyNotificationCount(1);
143 EXPECT_TRUE(model->state() == expected_new_state); 143 EXPECT_TRUE(model->state() == expected_new_state);
144 } 144 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_model.cc ('k') | chrome/common/search/search_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698