OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/message_center/cocoa/tray_view_controller.h" | 5 #import "ui/message_center/cocoa/tray_view_controller.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 11 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
12 #include "ui/message_center/fake_notifier_settings_provider.h" | 12 #include "ui/message_center/fake_notifier_settings_provider.h" |
13 #include "ui/message_center/message_center.h" | 13 #include "ui/message_center/message_center.h" |
14 #include "ui/message_center/message_center_impl.h" | 14 #include "ui/message_center/message_center_impl.h" |
15 #include "ui/message_center/message_center_style.h" | 15 #include "ui/message_center/message_center_style.h" |
16 #include "ui/message_center/notification.h" | 16 #include "ui/message_center/notification.h" |
17 #include "ui/message_center/notifier_settings.h" | 17 #include "ui/message_center/notifier_settings.h" |
18 | 18 |
19 using base::ASCIIToUTF16; | 19 using base::ASCIIToUTF16; |
20 | 20 |
21 namespace message_center { | 21 namespace message_center { |
22 | 22 |
23 class TrayViewControllerTest : public ui::CocoaTest { | 23 class TrayViewControllerTest : public ui::CocoaTest { |
24 public: | 24 public: |
25 TrayViewControllerTest() | 25 TrayViewControllerTest() |
26 : center_(NULL) { | 26 : center_(NULL) { |
27 } | 27 } |
28 | 28 |
29 virtual void SetUp() OVERRIDE { | 29 virtual void SetUp() override { |
30 ui::CocoaTest::SetUp(); | 30 ui::CocoaTest::SetUp(); |
31 message_center::MessageCenter::Initialize(); | 31 message_center::MessageCenter::Initialize(); |
32 center_ = message_center::MessageCenter::Get(); | 32 center_ = message_center::MessageCenter::Get(); |
33 center_->DisableTimersForTest(); | 33 center_->DisableTimersForTest(); |
34 tray_.reset([[MCTrayViewController alloc] initWithMessageCenter:center_]); | 34 tray_.reset([[MCTrayViewController alloc] initWithMessageCenter:center_]); |
35 [tray_ setAnimationDuration:0.002]; | 35 [tray_ setAnimationDuration:0.002]; |
36 [tray_ setAnimateClearingNextNotificationDelay:0.001]; | 36 [tray_ setAnimateClearingNextNotificationDelay:0.001]; |
37 [tray_ setAnimationEndedCallback:^{ | 37 [tray_ setAnimationEndedCallback:^{ |
38 if (nested_run_loop_.get()) | 38 if (nested_run_loop_.get()) |
39 nested_run_loop_->Quit(); | 39 nested_run_loop_->Quit(); |
40 }]; | 40 }]; |
41 [tray_ view]; // Create the view. | 41 [tray_ view]; // Create the view. |
42 } | 42 } |
43 | 43 |
44 virtual void TearDown() OVERRIDE { | 44 virtual void TearDown() override { |
45 tray_.reset(); | 45 tray_.reset(); |
46 message_center::MessageCenter::Shutdown(); | 46 message_center::MessageCenter::Shutdown(); |
47 ui::CocoaTest::TearDown(); | 47 ui::CocoaTest::TearDown(); |
48 } | 48 } |
49 | 49 |
50 void WaitForAnimationEnded() { | 50 void WaitForAnimationEnded() { |
51 if (![tray_ isAnimating]) | 51 if (![tray_ isAnimating]) |
52 return; | 52 return; |
53 nested_run_loop_.reset(new base::RunLoop()); | 53 nested_run_loop_.reset(new base::RunLoop()); |
54 nested_run_loop_->Run(); | 54 nested_run_loop_->Run(); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 NULL)); | 273 NULL)); |
274 center_->AddNotification(notification.Pass()); | 274 center_->AddNotification(notification.Pass()); |
275 [tray_ onMessageCenterTrayChanged]; | 275 [tray_ onMessageCenterTrayChanged]; |
276 | 276 |
277 EXPECT_FALSE([[tray_ divider] isHidden]); | 277 EXPECT_FALSE([[tray_ divider] isHidden]); |
278 EXPECT_FALSE([[tray_ scrollView] isHidden]); | 278 EXPECT_FALSE([[tray_ scrollView] isHidden]); |
279 EXPECT_TRUE([[tray_ emptyDescription] isHidden]); | 279 EXPECT_TRUE([[tray_ emptyDescription] isHidden]); |
280 } | 280 } |
281 | 281 |
282 } // namespace message_center | 282 } // namespace message_center |
OLD | NEW |