| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/ui/views/menu_test_base.h" | 7 #include "chrome/browser/ui/views/menu_test_base.h" |
| 8 #include "ui/views/controls/menu/menu_item_view.h" | 8 #include "ui/views/controls/menu/menu_item_view.h" |
| 9 #include "ui/views/controls/menu/submenu_view.h" | 9 #include "ui/views/controls/menu/submenu_view.h" |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 #if defined(USE_OZONE) | 87 #if defined(USE_OZONE) |
| 88 // ozone bringup - http://crbug.com/401304 | 88 // ozone bringup - http://crbug.com/401304 |
| 89 #define MAYBE_NoMatch DISABLED_NoMatch | 89 #define MAYBE_NoMatch DISABLED_NoMatch |
| 90 #else | 90 #else |
| 91 // If this flakes, disable and log details in http://crbug.com/523255. | 91 // If this flakes, disable and log details in http://crbug.com/523255. |
| 92 #define MAYBE_NoMatch NoMatch | 92 #define MAYBE_NoMatch NoMatch |
| 93 #endif | 93 #endif |
| 94 | 94 |
| 95 VIEW_TEST(MenuControllerMnemonicTestNoMatch, MAYBE_NoMatch); | 95 VIEW_TEST(MenuControllerMnemonicTestNoMatch, MAYBE_NoMatch); |
| 96 |
| 97 class MenuRunnerCancelTest : public MenuTestBase { |
| 98 public: |
| 99 MenuRunnerCancelTest() {} |
| 100 |
| 101 // MenuTestBase overrides: |
| 102 void BuildMenu(views::MenuItemView* menu) override { |
| 103 menu->AppendMenuItemWithLabel(1, base::ASCIIToUTF16("One&/")); |
| 104 menu->AppendMenuItemWithLabel(2, base::ASCIIToUTF16("Two")); |
| 105 } |
| 106 |
| 107 void DoTestWithMenuOpen() override { |
| 108 ASSERT_EQ(true, menu_runner()->IsRunning()); |
| 109 menu_runner()->Cancel(); |
| 110 // On calling Cancel, the nested message loop spun by the menu, should be |
| 111 // marked for termination. However, since we are still in the last |
| 112 // iteration of the nested message loop, MenuRunner::IsRunning(), should |
| 113 // return true. |
| 114 ASSERT_EQ(true, menu_runner()->IsRunning()); |
| 115 Done(); |
| 116 } |
| 117 |
| 118 private: |
| 119 DISALLOW_COPY_AND_ASSIGN(MenuRunnerCancelTest); |
| 120 }; |
| 121 |
| 122 // Test that MenuRunner::IsRunning() returns true, immediately after calling |
| 123 // MenuRunner::Cancel() for a syncronous menu. |
| 124 VIEW_TEST(MenuRunnerCancelTest, IsRunningAfterCancel); |
| OLD | NEW |