OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" |
8 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
11 #import "ui/base/cocoa/menu_controller.h" | 12 #import "ui/base/cocoa/menu_controller.h" |
12 #include "ui/base/models/simple_menu_model.h" | 13 #include "ui/base/models/simple_menu_model.h" |
13 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
14 #include "ui/events/test/cocoa_test_event_utils.h" | 15 #include "ui/events/test/cocoa_test_event_utils.h" |
15 #include "ui/gfx/image/image.h" | 16 #include "ui/gfx/image/image.h" |
16 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 17 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
17 #include "ui/resources/grit/ui_resources.h" | 18 #include "ui/resources/grit/ui_resources.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 // When control returns back to here, the menu will have finished running its | 380 // When control returns back to here, the menu will have finished running its |
380 // loop and will have closed itself (see Delegate::MenuWillShow). | 381 // loop and will have closed itself (see Delegate::MenuWillShow). |
381 EXPECT_TRUE(delegate.did_show_); | 382 EXPECT_TRUE(delegate.did_show_); |
382 | 383 |
383 // When the menu tells the Model it closed, the Model posts a task to notify | 384 // When the menu tells the Model it closed, the Model posts a task to notify |
384 // the delegate. But since this is a test and there's no running MessageLoop, | 385 // the delegate. But since this is a test and there's no running MessageLoop, |
385 // |did_close_| will remain false until we pump the task manually. | 386 // |did_close_| will remain false until we pump the task manually. |
386 EXPECT_FALSE(delegate.did_close_); | 387 EXPECT_FALSE(delegate.did_close_); |
387 | 388 |
388 // Pump the task that notifies the delegate. | 389 // Pump the task that notifies the delegate. |
389 message_loop.RunUntilIdle(); | 390 base::RunLoop().RunUntilIdle(); |
390 | 391 |
391 // Expect that the delegate got notified properly. | 392 // Expect that the delegate got notified properly. |
392 EXPECT_TRUE(delegate.did_close_); | 393 EXPECT_TRUE(delegate.did_close_); |
393 } | 394 } |
394 | 395 |
395 } // namespace | 396 } // namespace |
396 | 397 |
397 } // namespace ui | 398 } // namespace ui |
OLD | NEW |