Chromium Code Reviews| 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 ~MenuRunnerCancelTest() override {} | |
|
tapted
2016/05/27 02:58:55
nit: not needed?
karandeepb
2016/05/27 03:36:04
Done.
| |
| 102 | |
| 103 // MenuTestBase overrides: | |
| 104 void BuildMenu(views::MenuItemView* menu) override { | |
| 105 menu->AppendMenuItemWithLabel(1, base::ASCIIToUTF16("One&/")); | |
| 106 menu->AppendMenuItemWithLabel(2, base::ASCIIToUTF16("Two")); | |
| 107 } | |
| 108 | |
| 109 void DoTestWithMenuOpen() override { | |
| 110 ASSERT_EQ(true, menu_runner()->IsRunning()); | |
| 111 menu_runner()->Cancel(); | |
| 112 // On calling Cancel, the nested message loop spun by the menu, should be | |
| 113 // marked for termination. However, since we are still in the last | |
| 114 // iteration of the nested message loop, MenuRunner::IsRunning(), should | |
| 115 // return true. | |
| 116 ASSERT_EQ(true, menu_runner()->IsRunning()); | |
| 117 Done(); | |
| 118 } | |
| 119 | |
| 120 private: | |
| 121 DISALLOW_COPY_AND_ASSIGN(MenuRunnerCancelTest); | |
| 122 }; | |
| 123 | |
| 124 // Test that MenuRunner::IsRunning() returns true, immediately after calling | |
| 125 // MenuRunner::Cancel() for a syncronous menu. | |
| 126 VIEW_TEST(MenuRunnerCancelTest, IsRunningAfterCancel); | |
| OLD | NEW |