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 #include "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/test/base/interactive_test_utils.h" | 7 #include "chrome/test/base/interactive_test_utils.h" |
8 #include "chrome/test/base/ui_controls.h" | 8 #include "chrome/test/base/ui_controls.h" |
9 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
10 #include "chrome/test/base/view_event_test_base.h" | 10 #include "chrome/test/base/view_event_test_base.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 263 |
264 // Rebuild the menu which should close the submenu. | 264 // Rebuild the menu which should close the submenu. |
265 void Step2() { | 265 void Step2() { |
266 views::SubmenuView* topmenu = menu_->GetSubmenu(); | 266 views::SubmenuView* topmenu = menu_->GetSubmenu(); |
267 ASSERT_TRUE(topmenu); | 267 ASSERT_TRUE(topmenu); |
268 ASSERT_TRUE(topmenu->IsShowing()); | 268 ASSERT_TRUE(topmenu->IsShowing()); |
269 ASSERT_TRUE(top_menu_model_.IsSubmenuShowing()); | 269 ASSERT_TRUE(top_menu_model_.IsSubmenuShowing()); |
270 | 270 |
271 menu_model_adapter_.BuildMenu(menu_); | 271 menu_model_adapter_.BuildMenu(menu_); |
272 | 272 |
273 MessageLoopForUI::current()->PostTask( | 273 base::MessageLoopForUI::current()->PostTask( |
274 FROM_HERE, | 274 FROM_HERE, CreateEventTask(this, &MenuModelAdapterTest::Step3)); |
275 CreateEventTask(this, &MenuModelAdapterTest::Step3)); | |
276 } | 275 } |
277 | 276 |
278 // Verify that the submenu MenuModel received the close callback | 277 // Verify that the submenu MenuModel received the close callback |
279 // and close the menu. | 278 // and close the menu. |
280 void Step3() { | 279 void Step3() { |
281 views::SubmenuView* topmenu = menu_->GetSubmenu(); | 280 views::SubmenuView* topmenu = menu_->GetSubmenu(); |
282 ASSERT_TRUE(topmenu); | 281 ASSERT_TRUE(topmenu); |
283 ASSERT_TRUE(topmenu->IsShowing()); | 282 ASSERT_TRUE(topmenu->IsShowing()); |
284 ASSERT_FALSE(top_menu_model_.IsSubmenuShowing()); | 283 ASSERT_FALSE(top_menu_model_.IsSubmenuShowing()); |
285 | 284 |
(...skipping 30 matching lines...) Expand all Loading... |
316 views::MenuItemView* menu_; | 315 views::MenuItemView* menu_; |
317 scoped_ptr<views::MenuRunner> menu_runner_; | 316 scoped_ptr<views::MenuRunner> menu_runner_; |
318 }; | 317 }; |
319 | 318 |
320 #if defined(OS_WIN) | 319 #if defined(OS_WIN) |
321 #define MAYBE_RebuildMenu DISABLED_RebuildMenu | 320 #define MAYBE_RebuildMenu DISABLED_RebuildMenu |
322 #else | 321 #else |
323 #define MAYBE_RebuildMenu RebuildMenu | 322 #define MAYBE_RebuildMenu RebuildMenu |
324 #endif | 323 #endif |
325 VIEW_TEST(MenuModelAdapterTest, MAYBE_RebuildMenu) | 324 VIEW_TEST(MenuModelAdapterTest, MAYBE_RebuildMenu) |
OLD | NEW |