| 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/search/search.h" | 7 #include "chrome/browser/search/search.h" |
| 8 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 8 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 9 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 9 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
| 10 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 10 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // With popup open verify that tab does autocomplete. | 139 // With popup open verify that tab does autocomplete. |
| 140 popup_view.set_is_open(true); | 140 popup_view.set_is_open(true); |
| 141 view.OnDoCommandBySelector(@selector(insertTab:)); | 141 view.OnDoCommandBySelector(@selector(insertTab:)); |
| 142 EXPECT_EQ(1, model->up_or_down_count()); | 142 EXPECT_EQ(1, model->up_or_down_count()); |
| 143 view.OnDoCommandBySelector(@selector(insertBacktab:)); | 143 view.OnDoCommandBySelector(@selector(insertBacktab:)); |
| 144 EXPECT_EQ(-1, model->up_or_down_count()); | 144 EXPECT_EQ(-1, model->up_or_down_count()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 TEST_F(OmniboxViewMacTest, SetInstantSuggestion) { | 147 TEST_F(OmniboxViewMacTest, SetInstantSuggestion) { |
| 148 const NSRect frame = NSMakeRect(0, 0, 50, 30); | 148 const NSRect frame = NSMakeRect(0, 0, 50, 30); |
| 149 scoped_nsobject<AutocompleteTextField> field( | 149 base::scoped_nsobject<AutocompleteTextField> field( |
| 150 [[AutocompleteTextField alloc] initWithFrame:frame]); | 150 [[AutocompleteTextField alloc] initWithFrame:frame]); |
| 151 | 151 |
| 152 TestingToolbarModelDelegate delegate; | 152 TestingToolbarModelDelegate delegate; |
| 153 ToolbarModelImpl toolbar_model(&delegate); | 153 ToolbarModelImpl toolbar_model(&delegate); |
| 154 OmniboxViewMac view(NULL, &toolbar_model, profile(), NULL, field.get()); | 154 OmniboxViewMac view(NULL, &toolbar_model, profile(), NULL, field.get()); |
| 155 | 155 |
| 156 TestingOmniboxEditController controller; | 156 TestingOmniboxEditController controller; |
| 157 // This is deleted by the omnibox view. | 157 // This is deleted by the omnibox view. |
| 158 MockOmniboxEditModel* model = | 158 MockOmniboxEditModel* model = |
| 159 new MockOmniboxEditModel(&view, &controller, profile()); | 159 new MockOmniboxEditModel(&view, &controller, profile()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 // With popup open verify that pressing up and down arrow works. | 196 // With popup open verify that pressing up and down arrow works. |
| 197 popup_view.set_is_open(true); | 197 popup_view.set_is_open(true); |
| 198 model->set_up_or_down_count(0); | 198 model->set_up_or_down_count(0); |
| 199 view.OnDoCommandBySelector(@selector(moveDown:)); | 199 view.OnDoCommandBySelector(@selector(moveDown:)); |
| 200 EXPECT_EQ(1, model->up_or_down_count()); | 200 EXPECT_EQ(1, model->up_or_down_count()); |
| 201 model->set_up_or_down_count(0); | 201 model->set_up_or_down_count(0); |
| 202 view.OnDoCommandBySelector(@selector(moveUp:)); | 202 view.OnDoCommandBySelector(@selector(moveUp:)); |
| 203 EXPECT_EQ(-1, model->up_or_down_count()); | 203 EXPECT_EQ(-1, model->up_or_down_count()); |
| 204 } | 204 } |
| OLD | NEW |