OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 // Confirm basics about the bubble window (e.g. that its frame fits inside, or | 124 // Confirm basics about the bubble window (e.g. that its frame fits inside, or |
125 // almost completely fits inside, its parent window's frame). | 125 // almost completely fits inside, its parent window's frame). |
126 TEST_F(BookmarkBubbleControllerTest, TestBubbleWindow) { | 126 TEST_F(BookmarkBubbleControllerTest, TestBubbleWindow) { |
127 const BookmarkNode* node = CreateTestBookmark(); | 127 const BookmarkNode* node = CreateTestBookmark(); |
128 BookmarkBubbleController* controller = ControllerForNode(node); | 128 BookmarkBubbleController* controller = ControllerForNode(node); |
129 EXPECT_TRUE(controller); | 129 EXPECT_TRUE(controller); |
130 NSWindow* window = [controller window]; | 130 NSWindow* window = [controller window]; |
131 EXPECT_TRUE(window); | 131 EXPECT_TRUE(window); |
132 NSRect browser_window_frame = [browser()->window()->GetNativeWindow() frame]; | 132 NSRect browser_window_frame = [browser()->window()->GetNativeWindow() frame]; |
133 // The metrics have changed slightly under Material Design, so that in this | 133 // In this test case the bookmarks bubble's window frame extendeds slightly |
134 // test case the bookmarks bubble's window frame extendeds slightly beyond its | 134 // beyond its parent window's frame. |
135 // parent window's frame. | 135 browser_window_frame.size.width += 1; |
136 if (ui::MaterialDesignController::IsModeMaterial()) { | |
137 browser_window_frame.size.width += 1; | |
138 } | |
139 EXPECT_TRUE(NSContainsRect(browser_window_frame, [window frame])); | 136 EXPECT_TRUE(NSContainsRect(browser_window_frame, [window frame])); |
140 } | 137 } |
141 | 138 |
142 // Test that we can handle closing the parent window | 139 // Test that we can handle closing the parent window |
143 TEST_F(BookmarkBubbleControllerTest, TestClosingParentWindow) { | 140 TEST_F(BookmarkBubbleControllerTest, TestClosingParentWindow) { |
144 const BookmarkNode* node = CreateTestBookmark(); | 141 const BookmarkNode* node = CreateTestBookmark(); |
145 BookmarkBubbleController* controller = ControllerForNode(node); | 142 BookmarkBubbleController* controller = ControllerForNode(node); |
146 EXPECT_TRUE(controller); | 143 EXPECT_TRUE(controller); |
147 NSWindow* window = [controller window]; | 144 NSWindow* window = [controller window]; |
148 EXPECT_TRUE(window); | 145 EXPECT_TRUE(window); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 // Normally this would be sent up the responder tree correctly, but since | 478 // Normally this would be sent up the responder tree correctly, but since |
482 // tests run in the background, key window and main window are never set on | 479 // tests run in the background, key window and main window are never set on |
483 // NSApplication. Adding it to NSApplication directly removes the need for | 480 // NSApplication. Adding it to NSApplication directly removes the need for |
484 // worrying about what the current window with focus is. | 481 // worrying about what the current window with focus is. |
485 - (void)editBookmarkNode:(id)sender { | 482 - (void)editBookmarkNode:(id)sender { |
486 EXPECT_TRUE([sender respondsToSelector:@selector(node)]); | 483 EXPECT_TRUE([sender respondsToSelector:@selector(node)]); |
487 BookmarkBubbleControllerTest::edits_++; | 484 BookmarkBubbleControllerTest::edits_++; |
488 } | 485 } |
489 | 486 |
490 @end | 487 @end |
OLD | NEW |