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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" |
10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
11 #include "chrome/browser/ui/omnibox/chrome_omnibox_client.h" | 12 #include "chrome/browser/ui/omnibox/chrome_omnibox_client.h" |
12 #include "chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h" | 13 #include "chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h" |
13 #include "chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.h" | 14 #include "chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.h" |
14 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
15 #include "components/omnibox/browser/omnibox_popup_model.h" | 16 #include "components/omnibox/browser/omnibox_popup_model.h" |
16 #include "components/omnibox/browser/omnibox_popup_view.h" | 17 #include "components/omnibox/browser/omnibox_popup_view.h" |
17 #include "components/toolbar/toolbar_model_impl.h" | 18 #include "components/toolbar/toolbar_model_impl.h" |
18 #include "content/public/common/content_constants.h" | 19 #include "content/public/common/content_constants.h" |
19 #include "testing/platform_test.h" | 20 #include "testing/platform_test.h" |
20 #include "ui/gfx/font.h" | 21 #include "ui/gfx/font.h" |
21 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
22 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 class MockOmniboxEditModel : public OmniboxEditModel { | 27 class MockOmniboxEditModel : public OmniboxEditModel { |
27 public: | 28 public: |
28 MockOmniboxEditModel(OmniboxView* view, | 29 MockOmniboxEditModel(OmniboxView* view, |
29 OmniboxEditController* controller, | 30 OmniboxEditController* controller, |
30 Profile* profile) | 31 Profile* profile) |
31 : OmniboxEditModel( | 32 : OmniboxEditModel( |
32 view, | 33 view, |
33 controller, | 34 controller, |
34 make_scoped_ptr(new ChromeOmniboxClient(controller, profile))), | 35 base::WrapUnique(new ChromeOmniboxClient(controller, profile))), |
35 up_or_down_count_(0) {} | 36 up_or_down_count_(0) {} |
36 | 37 |
37 void OnUpOrDownKeyPressed(int count) override { up_or_down_count_ = count; } | 38 void OnUpOrDownKeyPressed(int count) override { up_or_down_count_ = count; } |
38 | 39 |
39 int up_or_down_count() const { return up_or_down_count_; } | 40 int up_or_down_count() const { return up_or_down_count_; } |
40 | 41 |
41 void set_up_or_down_count(int count) { | 42 void set_up_or_down_count(int count) { |
42 up_or_down_count_ = count; | 43 up_or_down_count_ = count; |
43 } | 44 } |
44 | 45 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 197 |
197 // With popup open verify that pressing up and down arrow works. | 198 // With popup open verify that pressing up and down arrow works. |
198 popup_view.set_is_open(true); | 199 popup_view.set_is_open(true); |
199 model->set_up_or_down_count(0); | 200 model->set_up_or_down_count(0); |
200 view.OnDoCommandBySelector(@selector(moveDown:)); | 201 view.OnDoCommandBySelector(@selector(moveDown:)); |
201 EXPECT_EQ(1, model->up_or_down_count()); | 202 EXPECT_EQ(1, model->up_or_down_count()); |
202 model->set_up_or_down_count(0); | 203 model->set_up_or_down_count(0); |
203 view.OnDoCommandBySelector(@selector(moveUp:)); | 204 view.OnDoCommandBySelector(@selector(moveUp:)); |
204 EXPECT_EQ(-1, model->up_or_down_count()); | 205 EXPECT_EQ(-1, model->up_or_down_count()); |
205 } | 206 } |
OLD | NEW |