| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <Cocoa/Cocoa.h> | 5 #include <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 10 #include "chrome/browser/cocoa/status_bubble_mac.h" | 10 #include "chrome/browser/cocoa/status_bubble_mac.h" |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
| 14 #import "third_party/GTM/AppKit/GTMTheme.h" | 14 #import "third_party/GTM/AppKit/GTMTheme.h" |
| 15 | 15 |
| 16 @interface StatusBubbleMacTestWindowDelegate : NSObject <GTMThemeDelegate>; | 16 @interface StatusBubbleMacTestWindowDelegate : NSObject <GTMThemeDelegate>; |
| 17 @end | 17 @end |
| 18 @implementation StatusBubbleMacTestWindowDelegate | 18 @implementation StatusBubbleMacTestWindowDelegate |
| 19 - (GTMTheme *)gtm_themeForWindow:(NSWindow *)window { | 19 - (GTMTheme*)gtm_themeForWindow:(NSWindow*)window { |
| 20 return [[[GTMTheme alloc] init] autorelease]; | 20 return [[[GTMTheme alloc] init] autorelease]; |
| 21 } | 21 } |
| 22 |
| 23 - (NSPoint)gtm_themePatternPhaseForWindow:(NSWindow*)window { |
| 24 return NSZeroPoint; |
| 25 } |
| 22 @end | 26 @end |
| 23 | 27 |
| 24 class StatusBubbleMacTest : public PlatformTest { | 28 class StatusBubbleMacTest : public PlatformTest { |
| 25 public: | 29 public: |
| 26 StatusBubbleMacTest() { | 30 StatusBubbleMacTest() { |
| 27 NSWindow* window = cocoa_helper_.window(); | 31 NSWindow* window = cocoa_helper_.window(); |
| 28 bubble_.reset(new StatusBubbleMac(window, nil)); | 32 bubble_.reset(new StatusBubbleMac(window, nil)); |
| 29 EXPECT_TRUE(bubble_.get()); | 33 EXPECT_TRUE(bubble_.get()); |
| 30 EXPECT_FALSE(bubble_->window_); // lazily creates window | 34 EXPECT_FALSE(bubble_->window_); // lazily creates window |
| 31 } | 35 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 frame.size.width += 50.0; // (fairly arbitrary nonzero value) | 161 frame.size.width += 50.0; // (fairly arbitrary nonzero value) |
| 158 frame.size.height += 50.0; // (fairly arbitrary nonzero value) | 162 frame.size.height += 50.0; // (fairly arbitrary nonzero value) |
| 159 [window setFrame:frame display:YES]; | 163 [window setFrame:frame display:YES]; |
| 160 bubble_->UpdateSizeAndPosition(); | 164 bubble_->UpdateSizeAndPosition(); |
| 161 rect_after = [GetWindow() frame]; | 165 rect_after = [GetWindow() frame]; |
| 162 EXPECT_EQ(rect_before.origin.x, rect_after.origin.x); | 166 EXPECT_EQ(rect_before.origin.x, rect_after.origin.x); |
| 163 EXPECT_EQ(rect_before.origin.y, rect_after.origin.y); | 167 EXPECT_EQ(rect_before.origin.y, rect_after.origin.y); |
| 164 EXPECT_NE(rect_before.size.width, rect_after.size.width); | 168 EXPECT_NE(rect_before.size.width, rect_after.size.width); |
| 165 EXPECT_EQ(rect_before.size.height, rect_after.size.height); | 169 EXPECT_EQ(rect_before.size.height, rect_after.size.height); |
| 166 } | 170 } |
| OLD | NEW |