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" | |
8 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 7 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
9 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
10 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 9 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
11 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" | 10 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" |
12 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" | 11 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" |
13 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" | 12 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
14 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
15 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
16 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
17 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void SetModel(OmniboxViewMac* view, OmniboxEditModel* model) { | 109 void SetModel(OmniboxViewMac* view, OmniboxEditModel* model) { |
111 view->model_.reset(model); | 110 view->model_.reset(model); |
112 } | 111 } |
113 }; | 112 }; |
114 | 113 |
115 TEST_F(OmniboxViewMacTest, GetFieldFont) { | 114 TEST_F(OmniboxViewMacTest, GetFieldFont) { |
116 EXPECT_TRUE(OmniboxViewMac::GetFieldFont()); | 115 EXPECT_TRUE(OmniboxViewMac::GetFieldFont()); |
117 } | 116 } |
118 | 117 |
119 TEST_F(OmniboxViewMacTest, TabToAutocomplete) { | 118 TEST_F(OmniboxViewMacTest, TabToAutocomplete) { |
120 chrome::EnableInstantExtendedAPIForTesting(); | |
121 OmniboxViewMac view(NULL, profile(), NULL, NULL); | 119 OmniboxViewMac view(NULL, profile(), NULL, NULL); |
122 | 120 |
123 // This is deleted by the omnibox view. | 121 // This is deleted by the omnibox view. |
124 MockOmniboxEditModel* model = | 122 MockOmniboxEditModel* model = |
125 new MockOmniboxEditModel(&view, NULL, profile()); | 123 new MockOmniboxEditModel(&view, NULL, profile()); |
126 SetModel(&view, model); | 124 SetModel(&view, model); |
127 | 125 |
128 MockOmniboxPopupView popup_view; | 126 MockOmniboxPopupView popup_view; |
129 OmniboxPopupModel popup_model(&popup_view, model); | 127 OmniboxPopupModel popup_model(&popup_view, model); |
130 | 128 |
(...skipping 63 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 |