| 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 #import "third_party/GTM/AppKit/GTMTheme.h" | 14 #import "third_party/GTM/AppKit/GTMTheme.h" |
| 14 | 15 |
| 15 @interface StatusBubbleMacTestWindowDelegate : NSObject <GTMThemeDelegate>; | 16 @interface StatusBubbleMacTestWindowDelegate : NSObject <GTMThemeDelegate>; |
| 16 @end | 17 @end |
| 17 @implementation StatusBubbleMacTestWindowDelegate | 18 @implementation StatusBubbleMacTestWindowDelegate |
| 18 - (GTMTheme *)gtm_themeForWindow:(NSWindow *)window { | 19 - (GTMTheme *)gtm_themeForWindow:(NSWindow *)window { |
| 19 NSLog(@"gettheme"); | 20 NSLog(@"gettheme"); |
| 20 return [[[GTMTheme alloc] init] autorelease]; | 21 return [[[GTMTheme alloc] init] autorelease]; |
| 21 } | 22 } |
| 22 @end | 23 @end |
| 23 | 24 |
| 24 class StatusBubbleMacTest : public testing::Test { | 25 class StatusBubbleMacTest : public PlatformTest { |
| 25 public: | 26 public: |
| 26 StatusBubbleMacTest() { | 27 StatusBubbleMacTest() { |
| 27 NSWindow* window = cocoa_helper_.window(); | 28 NSWindow* window = cocoa_helper_.window(); |
| 28 bubble_.reset(new StatusBubbleMac(window, nil)); | 29 bubble_.reset(new StatusBubbleMac(window, nil)); |
| 29 EXPECT_TRUE(bubble_.get()); | 30 EXPECT_TRUE(bubble_.get()); |
| 30 EXPECT_FALSE(bubble_->window_); // lazily creates window | 31 EXPECT_FALSE(bubble_->window_); // lazily creates window |
| 31 } | 32 } |
| 32 | 33 |
| 33 bool IsVisible() { | 34 bool IsVisible() { |
| 34 return [bubble_->window_ isVisible] ? true: false; | 35 return [bubble_->window_ isVisible] ? true: false; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 NSWindow* window = cocoa_helper_.window(); | 112 NSWindow* window = cocoa_helper_.window(); |
| 112 // Create and delete immediately. | 113 // Create and delete immediately. |
| 113 StatusBubbleMac* bubble = new StatusBubbleMac(window, nil); | 114 StatusBubbleMac* bubble = new StatusBubbleMac(window, nil); |
| 114 delete bubble; | 115 delete bubble; |
| 115 | 116 |
| 116 // Create then delete while visible. | 117 // Create then delete while visible. |
| 117 bubble = new StatusBubbleMac(window, nil); | 118 bubble = new StatusBubbleMac(window, nil); |
| 118 bubble->SetStatus(L"showing"); | 119 bubble->SetStatus(L"showing"); |
| 119 delete bubble; | 120 delete bubble; |
| 120 } | 121 } |
| OLD | NEW |