| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/scoped_nsobject.h" | 5 #include "base/scoped_nsobject.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/cocoa/browser_test_helper.h" | 7 #include "chrome/browser/cocoa/browser_test_helper.h" |
| 8 #include "chrome/browser/cocoa/cocoa_test_helper.h" | 8 #include "chrome/browser/cocoa/cocoa_test_helper.h" |
| 9 #include "chrome/browser/cocoa/notifications/balloon_controller.h" | 9 #include "chrome/browser/cocoa/notifications/balloon_controller.h" |
| 10 #include "chrome/browser/notifications/balloon.h" | 10 #include "chrome/browser/notifications/balloon.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 NOTREACHED(); | 39 NOTREACHED(); |
| 40 return balloons_; | 40 return balloons_; |
| 41 } | 41 } |
| 42 private: | 42 private: |
| 43 Balloons balloons_; | 43 Balloons balloons_; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 class BalloonControllerTest : public RenderViewHostTestHarness { | 46 class BalloonControllerTest : public RenderViewHostTestHarness { |
| 47 public: | 47 public: |
| 48 BalloonControllerTest() : | 48 BalloonControllerTest() : |
| 49 ui_thread_(ChromeThread::UI, MessageLoop::current()), | 49 ui_thread_(BrowserThread::UI, MessageLoop::current()), |
| 50 io_thread_(ChromeThread::IO, MessageLoop::current()) { | 50 io_thread_(BrowserThread::IO, MessageLoop::current()) { |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual void SetUp() { | 53 virtual void SetUp() { |
| 54 RenderViewHostTestHarness::SetUp(); | 54 RenderViewHostTestHarness::SetUp(); |
| 55 CocoaTest::BootstrapCocoa(); | 55 CocoaTest::BootstrapCocoa(); |
| 56 profile_.reset(new TestingProfile()); | 56 profile_.reset(new TestingProfile()); |
| 57 profile_->CreateRequestContext(); | 57 profile_->CreateRequestContext(); |
| 58 browser_.reset(new Browser(Browser::TYPE_NORMAL, profile_.get())); | 58 browser_.reset(new Browser(Browser::TYPE_NORMAL, profile_.get())); |
| 59 collection_.reset(new MockBalloonCollection()); | 59 collection_.reset(new MockBalloonCollection()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual void TearDown() { | 62 virtual void TearDown() { |
| 63 MessageLoop::current()->RunAllPending(); | 63 MessageLoop::current()->RunAllPending(); |
| 64 RenderViewHostTestHarness::TearDown(); | 64 RenderViewHostTestHarness::TearDown(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 protected: | 67 protected: |
| 68 ChromeThread ui_thread_; | 68 BrowserThread ui_thread_; |
| 69 ChromeThread io_thread_; | 69 BrowserThread io_thread_; |
| 70 scoped_ptr<TestingProfile> profile_; | 70 scoped_ptr<TestingProfile> profile_; |
| 71 scoped_ptr<Browser> browser_; | 71 scoped_ptr<Browser> browser_; |
| 72 scoped_ptr<BalloonCollection> collection_; | 72 scoped_ptr<BalloonCollection> collection_; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 TEST_F(BalloonControllerTest, ShowAndCloseTest) { | 75 TEST_F(BalloonControllerTest, ShowAndCloseTest) { |
| 76 Notification n(GURL("http://www.google.com"), GURL("http://www.google.com"), | 76 Notification n(GURL("http://www.google.com"), GURL("http://www.google.com"), |
| 77 ASCIIToUTF16("http://www.google.com"), string16(), | 77 ASCIIToUTF16("http://www.google.com"), string16(), |
| 78 new NotificationObjectProxy(-1, -1, -1, false)); | 78 new NotificationObjectProxy(-1, -1, -1, false)); |
| 79 scoped_ptr<Balloon> balloon( | 79 scoped_ptr<Balloon> balloon( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 102 | 102 |
| 103 [controller showWindow:nil]; | 103 [controller showWindow:nil]; |
| 104 | 104 |
| 105 EXPECT_TRUE([controller desiredTotalWidth] > 100); | 105 EXPECT_TRUE([controller desiredTotalWidth] > 100); |
| 106 EXPECT_TRUE([controller desiredTotalHeight] > 100); | 106 EXPECT_TRUE([controller desiredTotalHeight] > 100); |
| 107 | 107 |
| 108 [controller closeBalloon:YES]; | 108 [controller closeBalloon:YES]; |
| 109 } | 109 } |
| 110 | 110 |
| 111 } | 111 } |
| OLD | NEW |