| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h" | 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h" |
| 10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 ASSERT_EQ(nil, [bbfhs hoverButton]); | 40 ASSERT_EQ(nil, [bbfhs hoverButton]); |
| 41 | 41 |
| 42 // Test transition from closed to opening. | 42 // Test transition from closed to opening. |
| 43 ASSERT_EQ(kHoverStateClosed, [bbfhs hoverState]); | 43 ASSERT_EQ(kHoverStateClosed, [bbfhs hoverState]); |
| 44 [bbfhs scheduleOpenBookmarkFolderOnHoverButton:button]; | 44 [bbfhs scheduleOpenBookmarkFolderOnHoverButton:button]; |
| 45 ASSERT_EQ(kHoverStateOpening, [bbfhs hoverState]); | 45 ASSERT_EQ(kHoverStateOpening, [bbfhs hoverState]); |
| 46 | 46 |
| 47 // Test transition from opening to opened. | 47 // Test transition from opening to opened. |
| 48 message_loop.PostDelayedTask( | 48 message_loop.PostDelayedTask( |
| 49 FROM_HERE, | 49 FROM_HERE, |
| 50 new MessageLoop::QuitTask, | 50 MessageLoop::QuitClosure, |
| 51 bookmarks::kDragHoverOpenDelay * 1000.0 * 1.5); | 51 bookmarks::kDragHoverOpenDelay * 1000.0 * 1.5); |
| 52 message_loop.Run(); | 52 message_loop.Run(); |
| 53 ASSERT_EQ(kHoverStateOpen, [bbfhs hoverState]); | 53 ASSERT_EQ(kHoverStateOpen, [bbfhs hoverState]); |
| 54 ASSERT_EQ(button, [bbfhs hoverButton]); | 54 ASSERT_EQ(button, [bbfhs hoverButton]); |
| 55 | 55 |
| 56 // Test transition from opening to opened. | 56 // Test transition from opening to opened. |
| 57 [bbfhs scheduleCloseBookmarkFolderOnHoverButton]; | 57 [bbfhs scheduleCloseBookmarkFolderOnHoverButton]; |
| 58 ASSERT_EQ(kHoverStateClosing, [bbfhs hoverState]); | 58 ASSERT_EQ(kHoverStateClosing, [bbfhs hoverState]); |
| 59 | 59 |
| 60 // Test transition from closing to open (aka cancel close). | 60 // Test transition from closing to open (aka cancel close). |
| 61 [bbfhs cancelPendingCloseBookmarkFolderOnHoverButton]; | 61 [bbfhs cancelPendingCloseBookmarkFolderOnHoverButton]; |
| 62 ASSERT_EQ(kHoverStateOpen, [bbfhs hoverState]); | 62 ASSERT_EQ(kHoverStateOpen, [bbfhs hoverState]); |
| 63 ASSERT_EQ(button, [bbfhs hoverButton]); | 63 ASSERT_EQ(button, [bbfhs hoverButton]); |
| 64 | 64 |
| 65 // Test transition from closing to closed. | 65 // Test transition from closing to closed. |
| 66 [bbfhs scheduleCloseBookmarkFolderOnHoverButton]; | 66 [bbfhs scheduleCloseBookmarkFolderOnHoverButton]; |
| 67 ASSERT_EQ(kHoverStateClosing, [bbfhs hoverState]); | 67 ASSERT_EQ(kHoverStateClosing, [bbfhs hoverState]); |
| 68 message_loop.PostDelayedTask( | 68 message_loop.PostDelayedTask( |
| 69 FROM_HERE, | 69 FROM_HERE, |
| 70 new MessageLoop::QuitTask, | 70 MessageLoop::QuitClosure, |
| 71 bookmarks::kDragHoverCloseDelay * 1000.0 * 1.5); | 71 bookmarks::kDragHoverCloseDelay * 1000.0 * 1.5); |
| 72 message_loop.Run(); | 72 message_loop.Run(); |
| 73 ASSERT_EQ(kHoverStateClosed, [bbfhs hoverState]); | 73 ASSERT_EQ(kHoverStateClosed, [bbfhs hoverState]); |
| 74 ASSERT_EQ(nil, [bbfhs hoverButton]); | 74 ASSERT_EQ(nil, [bbfhs hoverButton]); |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace | 77 } // namespace |
| OLD | NEW |