| 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 #import "base/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 9 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 10 #import "chrome/browser/ui/cocoa/tabs/media_indicator_view.h" | 10 #import "chrome/browser/ui/cocoa/tabs/media_indicator_view.h" |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 base::scoped_nsobject<NSImage> image( | 366 base::scoped_nsobject<NSImage> image( |
| 367 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage()); | 367 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage()); |
| 368 [controller setIconImage:image]; | 368 [controller setIconImage:image]; |
| 369 NSView* newIcon = [controller iconView]; | 369 NSView* newIcon = [controller iconView]; |
| 370 EXPECT_TRUE([newIcon isHidden]); | 370 EXPECT_TRUE([newIcon isHidden]); |
| 371 | 371 |
| 372 // Tab is at selected minimum width. Since it's selected, the close box | 372 // Tab is at selected minimum width. Since it's selected, the close box |
| 373 // should be visible. | 373 // should be visible. |
| 374 [controller setSelected:YES]; | 374 [controller setSelected:YES]; |
| 375 frame = [[controller view] frame]; | 375 frame = [[controller view] frame]; |
| 376 frame.size.width = [TabController minSelectedTabWidth]; | 376 frame.size.width = [TabController minActiveTabWidth]; |
| 377 [[controller view] setFrame:frame]; | 377 [[controller view] setFrame:frame]; |
| 378 EXPECT_FALSE([controller shouldShowIcon]); | 378 EXPECT_FALSE([controller shouldShowIcon]); |
| 379 EXPECT_TRUE([newIcon isHidden]); | 379 EXPECT_TRUE([newIcon isHidden]); |
| 380 EXPECT_TRUE([controller shouldShowCloseButton]); | 380 EXPECT_TRUE([controller shouldShowCloseButton]); |
| 381 | 381 |
| 382 // Test expanding the tab to max width and ensure the icon and close box | 382 // Test expanding the tab to max width and ensure the icon and close box |
| 383 // get put back, even when de-selected. | 383 // get put back, even when de-selected. |
| 384 frame.size.width = [TabController maxTabWidth]; | 384 frame.size.width = [TabController maxTabWidth]; |
| 385 [[controller view] setFrame:frame]; | 385 [[controller view] setFrame:frame]; |
| 386 EXPECT_TRUE([controller shouldShowIcon]); | 386 EXPECT_TRUE([controller shouldShowIcon]); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 [[controller mediaIndicatorView] updateIndicator:mediaState]; | 518 [[controller mediaIndicatorView] updateIndicator:mediaState]; |
| 519 [controller setIconImage:favicon]; | 519 [controller setIconImage:favicon]; |
| 520 | 520 |
| 521 // Test layout for every width from maximum to minimum. | 521 // Test layout for every width from maximum to minimum. |
| 522 NSRect tabFrame = [[controller view] frame]; | 522 NSRect tabFrame = [[controller view] frame]; |
| 523 int minWidth; | 523 int minWidth; |
| 524 if (isMiniTab) { | 524 if (isMiniTab) { |
| 525 tabFrame.size.width = minWidth = [TabController miniTabWidth]; | 525 tabFrame.size.width = minWidth = [TabController miniTabWidth]; |
| 526 } else { | 526 } else { |
| 527 tabFrame.size.width = [TabController maxTabWidth]; | 527 tabFrame.size.width = [TabController maxTabWidth]; |
| 528 minWidth = isActiveTab ? [TabController minSelectedTabWidth] : | 528 minWidth = isActiveTab ? [TabController minActiveTabWidth] : |
| 529 [TabController minTabWidth]; | 529 [TabController minTabWidth]; |
| 530 } | 530 } |
| 531 while (NSWidth(tabFrame) >= minWidth) { | 531 while (NSWidth(tabFrame) >= minWidth) { |
| 532 SCOPED_TRACE(::testing::Message() << "width=" << tabFrame.size.width); | 532 SCOPED_TRACE(::testing::Message() << "width=" << tabFrame.size.width); |
| 533 [[controller view] setFrame:tabFrame]; | 533 [[controller view] setFrame:tabFrame]; |
| 534 CheckForExpectedLayoutAndVisibilityOfSubviews(controller); | 534 CheckForExpectedLayoutAndVisibilityOfSubviews(controller); |
| 535 --tabFrame.size.width; | 535 --tabFrame.size.width; |
| 536 } | 536 } |
| 537 } | 537 } |
| 538 } | 538 } |
| 539 } | 539 } |
| 540 } | 540 } |
| 541 | 541 |
| 542 } // namespace | 542 } // namespace |
| OLD | NEW |