| 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/memory/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" |
| 11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 12 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 12 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #import "testing/gtest_mac.h" | 14 #import "testing/gtest_mac.h" |
| 15 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
| 16 #import "third_party/ocmock/OCMock/OCMock.h" | 16 #import "third_party/ocmock/OCMock/OCMock.h" |
| 17 | 17 |
| 18 class FramedBrowserWindowTest : public CocoaTest { | 18 class FramedBrowserWindowTest : public CocoaTest { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 47 // Inset to mask off left and right edges which vary in HighDPI. | 47 // Inset to mask off left and right edges which vary in HighDPI. |
| 48 NSRect bounds = NSInsetRect([frameView bounds], 4, 0); | 48 NSRect bounds = NSInsetRect([frameView bounds], 4, 0); |
| 49 | 49 |
| 50 // On 10.6, the grippy changes appearance slightly when painted the second | 50 // On 10.6, the grippy changes appearance slightly when painted the second |
| 51 // time in a textured window. Since this test cares about the window title, | 51 // time in a textured window. Since this test cares about the window title, |
| 52 // cut off the bottom of the window. | 52 // cut off the bottom of the window. |
| 53 bounds.size.height -= 40; | 53 bounds.size.height -= 40; |
| 54 bounds.origin.y += 40; | 54 bounds.origin.y += 40; |
| 55 | 55 |
| 56 [frameView lockFocus]; | 56 [frameView lockFocus]; |
| 57 scoped_nsobject<NSBitmapImageRep> bitmap( | 57 base::scoped_nsobject<NSBitmapImageRep> bitmap( |
| 58 [[NSBitmapImageRep alloc] initWithFocusedViewRect:bounds]); | 58 [[NSBitmapImageRep alloc] initWithFocusedViewRect:bounds]); |
| 59 [frameView unlockFocus]; | 59 [frameView unlockFocus]; |
| 60 | 60 |
| 61 return [bitmap TIFFRepresentation]; | 61 return [bitmap TIFFRepresentation]; |
| 62 } | 62 } |
| 63 | 63 |
| 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 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 miniaturizeControl = [window_ standardWindowButton:NSWindowMiniaturizeButton]; | 170 miniaturizeControl = [window_ standardWindowButton:NSWindowMiniaturizeButton]; |
| 171 EXPECT_TRUE(miniaturizeControl); | 171 EXPECT_TRUE(miniaturizeControl); |
| 172 miniaturizeFrame = [miniaturizeControl frame]; | 172 miniaturizeFrame = [miniaturizeControl frame]; |
| 173 EXPECT_EQ(NSMaxY(miniaturizeFrame), | 173 EXPECT_EQ(NSMaxY(miniaturizeFrame), |
| 174 NSMaxY(windowBounds) - | 174 NSMaxY(windowBounds) - |
| 175 kFramedWindowButtonsWithTabStripOffsetFromTop); | 175 kFramedWindowButtonsWithTabStripOffsetFromTop); |
| 176 EXPECT_EQ(NSMinX(miniaturizeFrame), | 176 EXPECT_EQ(NSMinX(miniaturizeFrame), |
| 177 NSMaxX(closeBoxFrame) + [window_ windowButtonsInterButtonSpacing]); | 177 NSMaxX(closeBoxFrame) + [window_ windowButtonsInterButtonSpacing]); |
| 178 [window_ setWindowController:nil]; | 178 [window_ setWindowController:nil]; |
| 179 } | 179 } |
| OLD | NEW |