Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "ui/events/event_utils.h" | 6 #include "ui/events/event_utils.h" |
| 7 #include "ui/strings/grit/ui_strings.h" | 7 #include "ui/strings/grit/ui_strings.h" |
| 8 #include "ui/touch_selection/touch_selection_menu_runner.h" | 8 #include "ui/touch_selection/touch_selection_menu_runner.h" |
| 9 #include "ui/views/controls/button/button.h" | 9 #include "ui/views/controls/button/button.h" |
| 10 #include "ui/views/test/views_test_base.h" | 10 #include "ui/views/test/views_test_base.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 } | 23 } |
| 24 | 24 |
| 25 class TouchSelectionMenuRunnerViewsTest : public ViewsTestBase, | 25 class TouchSelectionMenuRunnerViewsTest : public ViewsTestBase, |
| 26 public ui::TouchSelectionMenuClient { | 26 public ui::TouchSelectionMenuClient { |
| 27 public: | 27 public: |
| 28 TouchSelectionMenuRunnerViewsTest() | 28 TouchSelectionMenuRunnerViewsTest() |
| 29 : no_command_available_(false), last_executed_command_id_(0) {} | 29 : no_command_available_(false), last_executed_command_id_(0) {} |
| 30 ~TouchSelectionMenuRunnerViewsTest() override {} | 30 ~TouchSelectionMenuRunnerViewsTest() override {} |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 void SetUp() override { | |
| 34 ViewsTestBase::SetUp(); | |
| 35 // These tests expect NativeWidgetAura, force it's creation. | |
|
msw
2016/11/08 23:38:27
nit: "its"
sky
2016/11/09 00:06:01
Done.
| |
| 36 // TODO(sky): the reason these end up using NativeWidgetAura is because they | |
|
msw
2016/11/08 23:38:27
optional nit: cite a bug?
sky
2016/11/09 00:06:01
Done.
| |
| 37 // create a widget parented to GetContext(). GetContext() currently always | |
| 38 // returns an aura::Window in a fake WindowTreeHost. For aura-mus we should | |
| 39 // not create a fake WindowTreeHost. | |
| 40 ViewsDelegate::GetInstance()->set_native_widget_factory( | |
| 41 ViewsDelegate::NativeWidgetFactory()); | |
| 42 } | |
| 43 | |
| 33 void set_no_commmand_available(bool no_command) { | 44 void set_no_commmand_available(bool no_command) { |
| 34 no_command_available_ = no_command; | 45 no_command_available_ = no_command; |
| 35 } | 46 } |
| 36 | 47 |
| 37 int last_executed_command_id() const { return last_executed_command_id_; } | 48 int last_executed_command_id() const { return last_executed_command_id_; } |
| 38 | 49 |
| 39 private: | 50 private: |
| 40 // ui::TouchSelectionMenuClient: | 51 // ui::TouchSelectionMenuClient: |
| 41 bool IsCommandIdEnabled(int command_id) const override { | 52 bool IsCommandIdEnabled(int command_id) const override { |
| 42 return !no_command_available_; | 53 return !no_command_available_; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 // Close the menu widget and check that menu runner correctly knows that menu | 178 // Close the menu widget and check that menu runner correctly knows that menu |
| 168 // is not running anymore. | 179 // is not running anymore. |
| 169 Widget* widget = test_api.GetWidget(); | 180 Widget* widget = test_api.GetWidget(); |
| 170 DCHECK(widget); | 181 DCHECK(widget); |
| 171 widget->Close(); | 182 widget->Close(); |
| 172 RunPendingMessages(); | 183 RunPendingMessages(); |
| 173 EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); | 184 EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); |
| 174 } | 185 } |
| 175 | 186 |
| 176 } // namespace views | 187 } // namespace views |
| OLD | NEW |