| 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/debug/debugger.h" | 7 #include "base/debug/debugger.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 FramedBrowserWindow* window_; | 64 FramedBrowserWindow* window_; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 // Baseline test that the window creates, displays, closes, and | 67 // Baseline test that the window creates, displays, closes, and |
| 68 // releases. | 68 // releases. |
| 69 TEST_F(FramedBrowserWindowTest, ShowAndClose) { | 69 TEST_F(FramedBrowserWindowTest, ShowAndClose) { |
| 70 [window_ display]; | 70 [window_ display]; |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Test that undocumented title-hiding API we're using does the job. | 73 // Test that undocumented title-hiding API we're using does the job. |
| 74 TEST_F(FramedBrowserWindowTest, DoesHideTitle) { | 74 // TODO(crbug.com/655112): Fails on Mac 10.11 Tests. |
| 75 TEST_F(FramedBrowserWindowTest, DISABLED_DoesHideTitle) { |
| 75 // The -display calls are not strictly necessary, but they do | 76 // The -display calls are not strictly necessary, but they do |
| 76 // make it easier to see what's happening when debugging (without | 77 // make it easier to see what's happening when debugging (without |
| 77 // them the changes are never flushed to the screen). | 78 // them the changes are never flushed to the screen). |
| 78 | 79 |
| 79 [window_ setTitle:@""]; | 80 [window_ setTitle:@""]; |
| 80 [window_ display]; | 81 [window_ display]; |
| 81 NSData* emptyTitleData = WindowContentsAsTIFF(); | 82 NSData* emptyTitleData = WindowContentsAsTIFF(); |
| 82 | 83 |
| 83 [window_ setTitle:@"This is a title"]; | 84 [window_ setTitle:@"This is a title"]; |
| 84 [window_ display]; | 85 [window_ display]; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 95 [window_ display]; | 96 [window_ display]; |
| 96 NSData* hiddenTitleData = WindowContentsAsTIFF(); | 97 NSData* hiddenTitleData = WindowContentsAsTIFF(); |
| 97 | 98 |
| 98 // With our magic setting, the window with a title should look the | 99 // With our magic setting, the window with a title should look the |
| 99 // same as the window with an empty title. | 100 // same as the window with an empty title. |
| 100 EXPECT_TRUE([window_ _isTitleHidden]); | 101 EXPECT_TRUE([window_ _isTitleHidden]); |
| 101 EXPECT_TRUE([emptyTitleData isEqualToData:hiddenTitleData]); | 102 EXPECT_TRUE([emptyTitleData isEqualToData:hiddenTitleData]); |
| 102 } | 103 } |
| 103 | 104 |
| 104 // Test to make sure that our window widgets are in the right place. | 105 // Test to make sure that our window widgets are in the right place. |
| 105 TEST_F(FramedBrowserWindowTest, WindowWidgetLocation) { | 106 // TODO(crbug.com/655112): Fails on Mac 10.11 Tests. |
| 107 TEST_F(FramedBrowserWindowTest, DISABLED_WindowWidgetLocation) { |
| 106 BOOL yes = YES; | 108 BOOL yes = YES; |
| 107 BOOL no = NO; | 109 BOOL no = NO; |
| 108 | 110 |
| 109 // First without a tabstrip. | 111 // First without a tabstrip. |
| 110 [window_ close]; | 112 [window_ close]; |
| 111 window_ = [[FramedBrowserWindow alloc] | 113 window_ = [[FramedBrowserWindow alloc] |
| 112 initWithContentRect:NSMakeRect(0, 0, 800, 600) | 114 initWithContentRect:NSMakeRect(0, 0, 800, 600) |
| 113 hasTabStrip:NO]; | 115 hasTabStrip:NO]; |
| 114 id controller = [OCMockObject mockForClass:[BrowserWindowController class]]; | 116 id controller = [OCMockObject mockForClass:[BrowserWindowController class]]; |
| 115 [[[controller stub] andReturnValue:OCMOCK_VALUE(yes)] | 117 [[[controller stub] andReturnValue:OCMOCK_VALUE(yes)] |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 miniaturizeControl = [window_ standardWindowButton:NSWindowMiniaturizeButton]; | 172 miniaturizeControl = [window_ standardWindowButton:NSWindowMiniaturizeButton]; |
| 171 EXPECT_TRUE(miniaturizeControl); | 173 EXPECT_TRUE(miniaturizeControl); |
| 172 miniaturizeFrame = [miniaturizeControl frame]; | 174 miniaturizeFrame = [miniaturizeControl frame]; |
| 173 EXPECT_EQ(NSMaxY(miniaturizeFrame), | 175 EXPECT_EQ(NSMaxY(miniaturizeFrame), |
| 174 NSMaxY(windowBounds) - | 176 NSMaxY(windowBounds) - |
| 175 kFramedWindowButtonsWithTabStripOffsetFromTop); | 177 kFramedWindowButtonsWithTabStripOffsetFromTop); |
| 176 EXPECT_EQ(NSMinX(miniaturizeFrame), | 178 EXPECT_EQ(NSMinX(miniaturizeFrame), |
| 177 NSMaxX(closeBoxFrame) + [window_ windowButtonsInterButtonSpacing]); | 179 NSMaxX(closeBoxFrame) + [window_ windowButtonsInterButtonSpacing]); |
| 178 [window_ setWindowController:nil]; | 180 [window_ setWindowController:nil]; |
| 179 } | 181 } |
| OLD | NEW |