| 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/popup_collection.h" | 5 #import "ui/message_center/cocoa/popup_collection.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #import "ui/base/test/ui_cocoa_test_helper.h" | 13 #import "ui/base/test/ui_cocoa_test_helper.h" |
| 14 #import "ui/message_center/cocoa/notification_controller.h" | 14 #import "ui/message_center/cocoa/notification_controller.h" |
| 15 #import "ui/message_center/cocoa/popup_controller.h" | 15 #import "ui/message_center/cocoa/popup_controller.h" |
| 16 #include "ui/message_center/message_center.h" | 16 #include "ui/message_center/message_center.h" |
| 17 #include "ui/message_center/message_center_style.h" | 17 #include "ui/message_center/message_center_style.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 if (![collection_ isAnimating]) | 104 if (![collection_ isAnimating]) |
| 105 return; | 105 return; |
| 106 nested_run_loop_.reset(new base::RunLoop()); | 106 nested_run_loop_.reset(new base::RunLoop()); |
| 107 nested_run_loop_->Run(); | 107 nested_run_loop_->Run(); |
| 108 nested_run_loop_.reset(); | 108 nested_run_loop_.reset(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 base::MessageLoop message_loop_; | 111 base::MessageLoop message_loop_; |
| 112 scoped_ptr<base::RunLoop> nested_run_loop_; | 112 scoped_ptr<base::RunLoop> nested_run_loop_; |
| 113 message_center::MessageCenter* center_; | 113 message_center::MessageCenter* center_; |
| 114 scoped_nsobject<MCPopupCollection> collection_; | 114 base::scoped_nsobject<MCPopupCollection> collection_; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 TEST_F(PopupCollectionTest, AddThreeCloseOne) { | 117 TEST_F(PopupCollectionTest, AddThreeCloseOne) { |
| 118 EXPECT_EQ(0u, [[collection_ popups] count]); | 118 EXPECT_EQ(0u, [[collection_ popups] count]); |
| 119 AddThreeNotifications(); | 119 AddThreeNotifications(); |
| 120 EXPECT_EQ(3u, [[collection_ popups] count]); | 120 EXPECT_EQ(3u, [[collection_ popups] count]); |
| 121 | 121 |
| 122 center_->RemoveNotification("2", true); | 122 center_->RemoveNotification("2", true); |
| 123 WaitForAnimationEnded(); | 123 WaitForAnimationEnded(); |
| 124 EXPECT_EQ(2u, [[collection_ popups] count]); | 124 EXPECT_EQ(2u, [[collection_ popups] count]); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 string16(), | 357 string16(), |
| 358 std::string(), | 358 std::string(), |
| 359 message_center::RichNotificationData(), | 359 message_center::RichNotificationData(), |
| 360 NULL)); | 360 NULL)); |
| 361 center_->UpdateNotification("1", notification.Pass()); | 361 center_->UpdateNotification("1", notification.Pass()); |
| 362 | 362 |
| 363 // Release the popup collection before the animation ends. No crash should | 363 // Release the popup collection before the animation ends. No crash should |
| 364 // be expected. | 364 // be expected. |
| 365 collection_.reset(); | 365 collection_.reset(); |
| 366 } | 366 } |
| OLD | NEW |