| 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 | 13 |
| 14 class StatusBubbleMacTest : public testing::Test { | 14 class StatusBubbleMacTest : public testing::Test { |
| 15 public: | 15 public: |
| 16 StatusBubbleMacTest() { | 16 StatusBubbleMacTest() { |
| 17 NSWindow* window = cocoa_helper_.window(); | 17 NSWindow* window = cocoa_helper_.window(); |
| 18 bubble_.reset(new StatusBubbleMac(window)); | 18 bubble_.reset(new StatusBubbleMac(window, nil)); |
| 19 EXPECT_TRUE(bubble_.get()); | 19 EXPECT_TRUE(bubble_.get()); |
| 20 EXPECT_FALSE(bubble_->window_); // lazily creates window | 20 EXPECT_FALSE(bubble_->window_); // lazily creates window |
| 21 } | 21 } |
| 22 | 22 |
| 23 bool IsVisible() { | 23 bool IsVisible() { |
| 24 return [bubble_->window_ isVisible] ? true: false; | 24 return [bubble_->window_ isVisible] ? true: false; |
| 25 } | 25 } |
| 26 NSString* GetText() { | 26 NSString* GetText() { |
| 27 return bubble_->status_text_; | 27 return bubble_->status_text_; |
| 28 } | 28 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 TEST_F(StatusBubbleMacTest, MouseMove) { | 82 TEST_F(StatusBubbleMacTest, MouseMove) { |
| 83 // TODO(pinkerton): Not sure what to do here since it relies on | 83 // TODO(pinkerton): Not sure what to do here since it relies on |
| 84 // [NSEvent currentEvent] and the current mouse location. | 84 // [NSEvent currentEvent] and the current mouse location. |
| 85 } | 85 } |
| 86 | 86 |
| 87 TEST_F(StatusBubbleMacTest, Delete) { | 87 TEST_F(StatusBubbleMacTest, Delete) { |
| 88 NSWindow* window = cocoa_helper_.window(); | 88 NSWindow* window = cocoa_helper_.window(); |
| 89 // Create and delete immediately. | 89 // Create and delete immediately. |
| 90 StatusBubbleMac* bubble = new StatusBubbleMac(window); | 90 StatusBubbleMac* bubble = new StatusBubbleMac(window, nil); |
| 91 delete bubble; | 91 delete bubble; |
| 92 | 92 |
| 93 // Create then delete while visible. | 93 // Create then delete while visible. |
| 94 bubble = new StatusBubbleMac(window); | 94 bubble = new StatusBubbleMac(window, nil); |
| 95 bubble->SetStatus(L"showing"); | 95 bubble->SetStatus(L"showing"); |
| 96 delete bubble; | 96 delete bubble; |
| 97 } | 97 } |
| OLD | NEW |