Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_controller_unittest.mm

Issue 1114993002: Add a message loop to TabControllerTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import "base/mac/scoped_nsobject.h" 7 #import "base/mac/scoped_nsobject.h"
8 #include "base/message_loop/message_loop.h"
8 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
10 #import "chrome/browser/ui/cocoa/tabs/media_indicator_button_cocoa.h" 11 #import "chrome/browser/ui/cocoa/tabs/media_indicator_button_cocoa.h"
11 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" 12 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h"
12 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h" 13 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h"
13 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" 14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h"
14 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 15 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #import "testing/gtest_mac.h" 17 #import "testing/gtest_mac.h"
17 #include "testing/platform_test.h" 18 #include "testing/platform_test.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 213 }
213 if ([controller shouldShowCloseButton]) { 214 if ([controller shouldShowCloseButton]) {
214 const NSRect closeButtonFrame = [[controller closeButton] frame]; 215 const NSRect closeButtonFrame = [[controller closeButton] frame];
215 if (NSWidth(titleFrame) > 0) 216 if (NSWidth(titleFrame) > 0)
216 EXPECT_LE(NSMaxX(titleFrame), NSMinX(closeButtonFrame)); 217 EXPECT_LE(NSMaxX(titleFrame), NSMinX(closeButtonFrame));
217 EXPECT_LE(NSMaxX(closeButtonFrame), NSMaxX(tabFrame)); 218 EXPECT_LE(NSMaxX(closeButtonFrame), NSMaxX(tabFrame));
218 EXPECT_LE(NSMinY(tabFrame), NSMinY(closeButtonFrame)); 219 EXPECT_LE(NSMinY(tabFrame), NSMinY(closeButtonFrame));
219 EXPECT_LE(NSMaxY(closeButtonFrame), NSMaxY(tabFrame)); 220 EXPECT_LE(NSMaxY(closeButtonFrame), NSMaxY(tabFrame));
220 } 221 }
221 } 222 }
223
224 private:
225 base::MessageLoop message_loop_;
222 }; 226 };
223 227
224 // Tests creating the controller, sticking it in a window, and removing it. 228 // Tests creating the controller, sticking it in a window, and removing it.
225 TEST_F(TabControllerTest, Creation) { 229 TEST_F(TabControllerTest, Creation) {
226 NSWindow* window = test_window(); 230 NSWindow* window = test_window();
227 base::scoped_nsobject<TabController> controller([[TabController alloc] init]); 231 base::scoped_nsobject<TabController> controller([[TabController alloc] init]);
228 [[window contentView] addSubview:[controller view]]; 232 [[window contentView] addSubview:[controller view]];
229 EXPECT_TRUE([controller tabView]); 233 EXPECT_TRUE([controller tabView]);
230 EXPECT_EQ([[controller view] window], window); 234 EXPECT_EQ([[controller view] window], window);
231 [[controller view] display]; // Test drawing to ensure nothing leaks/crashes. 235 [[controller view] display]; // Test drawing to ensure nothing leaks/crashes.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 [[controller view] setFrame:tabFrame]; 536 [[controller view] setFrame:tabFrame];
533 CheckForExpectedLayoutAndVisibilityOfSubviews(controller); 537 CheckForExpectedLayoutAndVisibilityOfSubviews(controller);
534 --tabFrame.size.width; 538 --tabFrame.size.width;
535 } 539 }
536 } 540 }
537 } 541 }
538 } 542 }
539 } 543 }
540 544
541 } // namespace 545 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698