| 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 "ui/views/controls/menu/menu_runner.h" | 5 #include "ui/views/controls/menu/menu_runner.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 MenuRunner* runner_; | 210 MenuRunner* runner_; |
| 211 Widget* owner_; | 211 Widget* owner_; |
| 212 | 212 |
| 213 DISALLOW_COPY_AND_ASSIGN(MenuLauncherEventHandler); | 213 DISALLOW_COPY_AND_ASSIGN(MenuLauncherEventHandler); |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 } // namespace | 216 } // namespace |
| 217 | 217 |
| 218 // Tests that when a mouse press launches a menu, that the target widget does | 218 // Tests that when a mouse press launches a menu, that the target widget does |
| 219 // not take explicit capture, nor closes the menu. | 219 // not take explicit capture, nor closes the menu. |
| 220 TEST_F(MenuRunnerTest, WidgetDoesntTakeCapture) { | 220 // Disabled on Mac (GetGlobalCapture() not yet implemented). |
| 221 // http://crbug.com//622979. |
| 222 #if defined(OS_MACOSX) |
| 223 #define MAYBE_WidgetDoesntTakeCapture DISABLED_WidgetDoesntTakeCapture |
| 224 #else |
| 225 #define MAYBE_WidgetDoesntTakeCapture WidgetDoesntTakeCapture |
| 226 #endif |
| 227 TEST_F(MenuRunnerTest, MAYBE_WidgetDoesntTakeCapture) { |
| 221 Widget* widget = new Widget; | 228 Widget* widget = new Widget; |
| 222 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); | 229 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); |
| 223 widget->Init(params); | 230 widget->Init(params); |
| 224 widget->Show(); | 231 widget->Show(); |
| 225 widget->SetSize(gfx::Size(300, 300)); | 232 widget->SetSize(gfx::Size(300, 300)); |
| 226 | 233 |
| 227 EventCountView* event_count_view = new EventCountView(); | 234 EventCountView* event_count_view = new EventCountView(); |
| 228 event_count_view->SetBounds(0, 0, 300, 300); | 235 event_count_view->SetBounds(0, 0, 300, 300); |
| 229 widget->GetRootView()->AddChildView(event_count_view); | 236 widget->GetRootView()->AddChildView(event_count_view); |
| 230 | 237 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 menu_runner->OnMenuClosed(internal::MenuControllerDelegate::NOTIFY_DELEGATE, | 292 menu_runner->OnMenuClosed(internal::MenuControllerDelegate::NOTIFY_DELEGATE, |
| 286 nullptr, 0); | 293 nullptr, 0); |
| 287 | 294 |
| 288 // This should not access the destroyed MenuController | 295 // This should not access the destroyed MenuController |
| 289 menu_runner2->Release(); | 296 menu_runner2->Release(); |
| 290 menu_runner->Release(); | 297 menu_runner->Release(); |
| 291 } | 298 } |
| 292 | 299 |
| 293 } // namespace test | 300 } // namespace test |
| 294 } // namespace views | 301 } // namespace views |
| OLD | NEW |