OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
6 | 6 |
7 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 7 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
8 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
9 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 9 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
10 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" | 10 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 // With popup open verify that tab does autocomplete. | 136 // With popup open verify that tab does autocomplete. |
137 popup_view.set_is_open(true); | 137 popup_view.set_is_open(true); |
138 view.OnDoCommandBySelector(@selector(insertTab:)); | 138 view.OnDoCommandBySelector(@selector(insertTab:)); |
139 EXPECT_EQ(1, model->up_or_down_count()); | 139 EXPECT_EQ(1, model->up_or_down_count()); |
140 view.OnDoCommandBySelector(@selector(insertBacktab:)); | 140 view.OnDoCommandBySelector(@selector(insertBacktab:)); |
141 EXPECT_EQ(-1, model->up_or_down_count()); | 141 EXPECT_EQ(-1, model->up_or_down_count()); |
142 } | 142 } |
143 | 143 |
144 TEST_F(OmniboxViewMacTest, SetInstantSuggestion) { | 144 TEST_F(OmniboxViewMacTest, SetInstantSuggestion) { |
145 chrome::search::EnableInstantExtendedAPIForTesting(); | |
146 | |
147 const NSRect frame = NSMakeRect(0, 0, 50, 30); | 145 const NSRect frame = NSMakeRect(0, 0, 50, 30); |
148 scoped_nsobject<AutocompleteTextField> field( | 146 scoped_nsobject<AutocompleteTextField> field( |
149 [[AutocompleteTextField alloc] initWithFrame:frame]); | 147 [[AutocompleteTextField alloc] initWithFrame:frame]); |
150 | 148 |
151 TestingToolbarModelDelegate delegate; | 149 TestingToolbarModelDelegate delegate; |
152 ToolbarModelImpl toolbar_model(&delegate); | 150 ToolbarModelImpl toolbar_model(&delegate); |
153 OmniboxViewMac view(NULL, &toolbar_model, profile(), NULL, field.get()); | 151 OmniboxViewMac view(NULL, &toolbar_model, profile(), NULL, field.get()); |
154 | 152 |
155 TestingOmniboxEditController controller; | 153 TestingOmniboxEditController controller; |
156 // This is deleted by the omnibox view. | 154 // This is deleted by the omnibox view. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 192 |
195 // With popup open verify that pressing up and down arrow works. | 193 // With popup open verify that pressing up and down arrow works. |
196 popup_view.set_is_open(true); | 194 popup_view.set_is_open(true); |
197 model->set_up_or_down_count(0); | 195 model->set_up_or_down_count(0); |
198 view.OnDoCommandBySelector(@selector(moveDown:)); | 196 view.OnDoCommandBySelector(@selector(moveDown:)); |
199 EXPECT_EQ(1, model->up_or_down_count()); | 197 EXPECT_EQ(1, model->up_or_down_count()); |
200 model->set_up_or_down_count(0); | 198 model->set_up_or_down_count(0); |
201 view.OnDoCommandBySelector(@selector(moveUp:)); | 199 view.OnDoCommandBySelector(@selector(moveUp:)); |
202 EXPECT_EQ(-1, model->up_or_down_count()); | 200 EXPECT_EQ(-1, model->up_or_down_count()); |
203 } | 201 } |
OLD | NEW |