| 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 "ui/message_center/cocoa/tray_controller.h" | 5 #import "ui/message_center/cocoa/tray_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/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 #import "ui/base/test/ui_cocoa_test_helper.h" | 9 #import "ui/base/test/ui_cocoa_test_helper.h" |
| 10 #include "ui/message_center/message_center.h" | 10 #include "ui/message_center/message_center.h" |
| 11 #include "ui/message_center/message_center_tray.h" | 11 #include "ui/message_center/message_center_tray.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace message_center { |
| 14 | 14 |
| 15 class TrayControllerTest : public ui::CocoaTest { | 15 class TrayControllerTest : public ui::CocoaTest { |
| 16 public: | 16 public: |
| 17 virtual void SetUp() OVERRIDE { | 17 virtual void SetUp() OVERRIDE { |
| 18 ui::CocoaTest::SetUp(); | 18 ui::CocoaTest::SetUp(); |
| 19 message_center::MessageCenter::Initialize(); | 19 message_center::MessageCenter::Initialize(); |
| 20 tray_.reset(new message_center::MessageCenterTray( | 20 tray_.reset(new message_center::MessageCenterTray( |
| 21 NULL, message_center::MessageCenter::Get())); | 21 NULL, message_center::MessageCenter::Get())); |
| 22 controller_.reset( | 22 controller_.reset( |
| 23 [[MCTrayController alloc] initWithMessageCenterTray:tray_.get()]); | 23 [[MCTrayController alloc] initWithMessageCenterTray:tray_.get()]); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 49 NSRect window_frame = [[controller_ window] frame]; | 49 NSRect window_frame = [[controller_ window] frame]; |
| 50 EXPECT_EQ(right_point.x, NSMinX(window_frame)); | 50 EXPECT_EQ(right_point.x, NSMinX(window_frame)); |
| 51 | 51 |
| 52 // With little room on the right, it should open to the left. | 52 // With little room on the right, it should open to the left. |
| 53 right_point = NSMakePoint(NSMaxX(screen_frame) - 10, y); | 53 right_point = NSMakePoint(NSMaxX(screen_frame) - 10, y); |
| 54 [controller_ showTrayAtRightOf:right_point atLeftOf:left_point]; | 54 [controller_ showTrayAtRightOf:right_point atLeftOf:left_point]; |
| 55 window_frame = [[controller_ window] frame]; | 55 window_frame = [[controller_ window] frame]; |
| 56 EXPECT_EQ(left_point.x - NSWidth(window_frame), NSMinX(window_frame)); | 56 EXPECT_EQ(left_point.x - NSWidth(window_frame), NSMinX(window_frame)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace message_center |
| OLD | NEW |