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 "chrome/browser/ui/cocoa/download/download_shelf_controller.h" | 5 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #import "base/mac/scoped_block.h" | 12 #import "base/mac/scoped_block.h" |
13 #import "base/mac/scoped_nsobject.h" | 13 #import "base/mac/scoped_nsobject.h" |
| 14 #include "base/run_loop.h" |
14 #include "chrome/browser/download/download_shelf.h" | 15 #include "chrome/browser/download/download_shelf.h" |
15 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 16 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
16 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" | 17 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" |
17 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" | 18 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" |
18 #include "content/public/test/mock_download_item.h" | 19 #include "content/public/test/mock_download_item.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "testing/platform_test.h" | 21 #include "testing/platform_test.h" |
21 #import "third_party/ocmock/OCMock/OCMock.h" | 22 #import "third_party/ocmock/OCMock/OCMock.h" |
22 #import "third_party/ocmock/gtest_support.h" | 23 #import "third_party/ocmock/gtest_support.h" |
23 #import "ui/events/test/cocoa_test_event_utils.h" | 24 #import "ui/events/test/cocoa_test_event_utils.h" |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 EXPECT_EQ(3, shelf_.get()->cancelAutoCloseCount_); | 385 EXPECT_EQ(3, shelf_.get()->cancelAutoCloseCount_); |
385 shelf_.reset(); | 386 shelf_.reset(); |
386 } | 387 } |
387 | 388 |
388 // The view should not be hidden when the shelf is shown. | 389 // The view should not be hidden when the shelf is shown. |
389 // The view should be hidden after the closing animation. | 390 // The view should be hidden after the closing animation. |
390 TEST_F(DownloadShelfControllerTest, ViewVisibility) { | 391 TEST_F(DownloadShelfControllerTest, ViewVisibility) { |
391 [shelf_ showDownloadShelf:YES isUserAction:NO]; | 392 [shelf_ showDownloadShelf:YES isUserAction:NO]; |
392 EXPECT_FALSE([[shelf_ view] isHidden]); | 393 EXPECT_FALSE([[shelf_ view] isHidden]); |
393 | 394 |
| 395 base::RunLoop run_loop; |
| 396 base::RunLoop* const run_loop_ptr = &run_loop; |
| 397 |
394 [shelf_ setCloseAnimationHandler:^{ | 398 [shelf_ setCloseAnimationHandler:^{ |
395 base::MessageLoop::current()->QuitNow(); | 399 run_loop_ptr->Quit(); |
396 }]; | 400 }]; |
397 [shelf_ showDownloadShelf:NO isUserAction:NO]; | 401 [shelf_ showDownloadShelf:NO isUserAction:NO]; |
398 base::MessageLoop::current()->Run(); | 402 run_loop.Run(); |
399 EXPECT_TRUE([[shelf_ view] isHidden]); | 403 EXPECT_TRUE([[shelf_ view] isHidden]); |
400 | 404 |
401 [shelf_ showDownloadShelf:YES isUserAction:NO]; | 405 [shelf_ showDownloadShelf:YES isUserAction:NO]; |
402 EXPECT_FALSE([[shelf_ view] isHidden]); | 406 EXPECT_FALSE([[shelf_ view] isHidden]); |
403 } | 407 } |
404 | 408 |
405 } // namespace | 409 } // namespace |
OLD | NEW |