| 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/memory/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/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/base/test/ui_cocoa_test_helper.h" | 11 #import "ui/base/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" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 nested_run_loop_.reset(new base::RunLoop()); | 50 nested_run_loop_.reset(new base::RunLoop()); |
| 51 nested_run_loop_->Run(); | 51 nested_run_loop_->Run(); |
| 52 nested_run_loop_.reset(); | 52 nested_run_loop_.reset(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 message_center::MessageCenter* center_; // Weak, global. | 56 message_center::MessageCenter* center_; // Weak, global. |
| 57 | 57 |
| 58 base::MessageLoop message_loop_; | 58 base::MessageLoop message_loop_; |
| 59 scoped_ptr<base::RunLoop> nested_run_loop_; | 59 scoped_ptr<base::RunLoop> nested_run_loop_; |
| 60 scoped_nsobject<MCTrayViewController> tray_; | 60 base::scoped_nsobject<MCTrayViewController> tray_; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 TEST_F(TrayViewControllerTest, AddRemoveOne) { | 63 TEST_F(TrayViewControllerTest, AddRemoveOne) { |
| 64 NSScrollView* view = [[tray_ scrollView] documentView]; | 64 NSScrollView* view = [[tray_ scrollView] documentView]; |
| 65 EXPECT_EQ(0u, [[view subviews] count]); | 65 EXPECT_EQ(0u, [[view subviews] count]); |
| 66 scoped_ptr<message_center::Notification> notification_data; | 66 scoped_ptr<message_center::Notification> notification_data; |
| 67 notification_data.reset(new message_center::Notification( | 67 notification_data.reset(new message_center::Notification( |
| 68 message_center::NOTIFICATION_TYPE_SIMPLE, | 68 message_center::NOTIFICATION_TYPE_SIMPLE, |
| 69 "1", | 69 "1", |
| 70 ASCIIToUTF16("First notification"), | 70 ASCIIToUTF16("First notification"), |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 EXPECT_LT(trayHeight, NSHeight([[tray_ view] frame])); | 230 EXPECT_LT(trayHeight, NSHeight([[tray_ view] frame])); |
| 231 | 231 |
| 232 [tray_ hideSettings:nil]; | 232 [tray_ hideSettings:nil]; |
| 233 EXPECT_EQ(1, provider.closed_called_count()); | 233 EXPECT_EQ(1, provider.closed_called_count()); |
| 234 | 234 |
| 235 // The tray should be back at its previous height now. | 235 // The tray should be back at its previous height now. |
| 236 EXPECT_EQ(trayHeight, NSHeight([[tray_ view] frame])); | 236 EXPECT_EQ(trayHeight, NSHeight([[tray_ view] frame])); |
| 237 } | 237 } |
| 238 | 238 |
| 239 } // namespace message_center | 239 } // namespace message_center |
| OLD | NEW |