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

Unified Diff: chrome/browser/cocoa/chrome_browser_window_unittest.mm

Issue 260009: Several background pattern fixes on the Mac.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/chrome_browser_window.mm ('k') | chrome/browser/cocoa/download_shelf_view.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/chrome_browser_window_unittest.mm
===================================================================
--- chrome/browser/cocoa/chrome_browser_window_unittest.mm (revision 28537)
+++ chrome/browser/cocoa/chrome_browser_window_unittest.mm (working copy)
@@ -8,6 +8,7 @@
#include "chrome/app/chrome_dll_resource.h"
#import "chrome/browser/cocoa/chrome_browser_window.h"
#import "chrome/browser/cocoa/browser_window_controller.h"
+#import "chrome/browser/cocoa/browser_frame_view.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -73,7 +74,7 @@
// forwards it to [delegate executeCommand:]. Assume that other
// CommandForKeyboardShortcut() will work the same for the rest.
TEST_F(ChromeBrowserWindowTest, PerformKeyEquivalentForwardToExecuteCommand) {
- NSEvent *event = KeyEvent(NSCommandKeyMask, kVK_ANSI_1);
+ NSEvent* event = KeyEvent(NSCommandKeyMask, kVK_ANSI_1);
id delegate = [OCMockObject mockForClass:[BrowserWindowController class]];
// -stub to satisfy the DCHECK.
@@ -95,7 +96,7 @@
// TODO(shess) Think of a way to test that it is sent to the
// superclass.
TEST_F(ChromeBrowserWindowTest, PerformKeyEquivalentNoForward) {
- NSEvent *event = KeyEvent(0, 0);
+ NSEvent* event = KeyEvent(0, 0);
id delegate = [OCMockObject mockForClass:[BrowserWindowController class]];
// -stub to satisfy the DCHECK.
@@ -142,4 +143,50 @@
EXPECT_TRUE([emptyTitleData isEqualToData:hiddenTitleData]);
}
+// Test to make sure that our window widgets are in the right place.
+TEST_F(ChromeBrowserWindowTest, WindowWidgetLocation) {
+ NSCell* closeBoxCell = [window_ accessibilityAttributeValue:
+ NSAccessibilityCloseButtonAttribute];
+ NSView* closeBoxControl = [closeBoxCell controlView];
+ EXPECT_TRUE(closeBoxControl);
+ NSRect closeBoxFrame = [closeBoxControl frame];
+ NSRect windowBounds = [window_ frame];
+ windowBounds.origin = NSZeroPoint;
+ EXPECT_EQ(NSMaxY(closeBoxFrame),
+ NSMaxY(windowBounds) - kChromeWindowButtonsOffsetFromTop);
+ EXPECT_EQ(NSMinX(closeBoxFrame), kChromeWindowButtonsOffsetFromLeft);
+
+ NSCell* miniaturizeCell = [window_ accessibilityAttributeValue:
+ NSAccessibilityMinimizeButtonAttribute];
+ NSView* miniaturizeControl = [miniaturizeCell controlView];
+ EXPECT_TRUE(miniaturizeControl);
+ NSRect miniaturizeFrame = [miniaturizeControl frame];
+ EXPECT_EQ(NSMaxY(miniaturizeFrame),
+ NSMaxY(windowBounds) - kChromeWindowButtonsOffsetFromTop);
+ EXPECT_EQ(NSMinX(miniaturizeFrame),
+ NSMaxX(closeBoxFrame) + kChromeWindowButtonsInterButtonSpacing);
+}
+
+// Test that we actually have a tracking area in place.
+TEST_F(ChromeBrowserWindowTest, WindowWidgetTrackingArea) {
+ NSCell* closeBoxCell = [window_ accessibilityAttributeValue:
+ NSAccessibilityCloseButtonAttribute];
+ NSView* closeBoxControl = [closeBoxCell controlView];
+ NSView* frameView = [[window_ contentView] superview];
+ NSArray* trackingAreas = [frameView trackingAreas];
+ NSPoint point = [closeBoxControl frame].origin;
+ point.x += 1;
+ point.y += 1;
+ BOOL foundArea = NO;
+ for (NSTrackingArea* area in trackingAreas) {
+ NSRect rect = [area rect];
+ foundArea = NSPointInRect(point, rect);
+ if (foundArea) {
+ EXPECT_TRUE([[area owner] isEqual:window_]);
+ break;
+ }
+ }
+ EXPECT_TRUE(foundArea);
+}
+
} // namespace
Property changes on: chrome/browser/cocoa/chrome_browser_window_unittest.mm
___________________________________________________________________
Name: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/cocoa/chrome_browser_window.mm ('k') | chrome/browser/cocoa/download_shelf_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698