| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_nsobject.h" | 5 #include "base/memory/scoped_nsobject.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/notifications/balloon.h" | 7 #include "chrome/browser/notifications/balloon.h" |
| 8 #include "chrome/browser/notifications/balloon_collection.h" | 8 #include "chrome/browser/notifications/balloon_collection.h" |
| 9 #include "chrome/browser/notifications/notification.h" | 9 #include "chrome/browser/notifications/notification.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 return balloons_; | 45 return balloons_; |
| 46 } | 46 } |
| 47 private: | 47 private: |
| 48 Balloons balloons_; | 48 Balloons balloons_; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 class BalloonControllerTest : public ChromeRenderViewHostTestHarness { | 51 class BalloonControllerTest : public ChromeRenderViewHostTestHarness { |
| 52 public: | 52 public: |
| 53 BalloonControllerTest() : | 53 BalloonControllerTest() : |
| 54 ui_thread_(BrowserThread::UI, MessageLoop::current()), | 54 ui_thread_(BrowserThread::UI, MessageLoop::current()), |
| 55 file_user_blocking_thread_( |
| 56 BrowserThread::FILE_USER_BLOCKING, MessageLoop::current()), |
| 55 io_thread_(BrowserThread::IO, MessageLoop::current()) { | 57 io_thread_(BrowserThread::IO, MessageLoop::current()) { |
| 56 } | 58 } |
| 57 | 59 |
| 58 virtual void SetUp() { | 60 virtual void SetUp() { |
| 59 ChromeRenderViewHostTestHarness::SetUp(); | 61 ChromeRenderViewHostTestHarness::SetUp(); |
| 60 CocoaTest::BootstrapCocoa(); | 62 CocoaTest::BootstrapCocoa(); |
| 61 profile()->CreateRequestContext(); | 63 profile()->CreateRequestContext(); |
| 62 browser_.reset(new Browser(Browser::TYPE_TABBED, profile())); | 64 browser_.reset(new Browser(Browser::TYPE_TABBED, profile())); |
| 63 collection_.reset(new MockBalloonCollection()); | 65 collection_.reset(new MockBalloonCollection()); |
| 64 } | 66 } |
| 65 | 67 |
| 66 virtual void TearDown() { | 68 virtual void TearDown() { |
| 67 collection_.reset(); | 69 collection_.reset(); |
| 68 browser_.reset(); | 70 browser_.reset(); |
| 69 MessageLoop::current()->RunAllPending(); | 71 MessageLoop::current()->RunAllPending(); |
| 70 ChromeRenderViewHostTestHarness::TearDown(); | 72 ChromeRenderViewHostTestHarness::TearDown(); |
| 71 } | 73 } |
| 72 | 74 |
| 73 protected: | 75 protected: |
| 74 content::TestBrowserThread ui_thread_; | 76 content::TestBrowserThread ui_thread_; |
| 77 content::TestBrowserThread file_user_blocking_thread_; |
| 75 content::TestBrowserThread io_thread_; | 78 content::TestBrowserThread io_thread_; |
| 76 scoped_ptr<Browser> browser_; | 79 scoped_ptr<Browser> browser_; |
| 77 scoped_ptr<BalloonCollection> collection_; | 80 scoped_ptr<BalloonCollection> collection_; |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 TEST_F(BalloonControllerTest, ShowAndCloseTest) { | 83 TEST_F(BalloonControllerTest, ShowAndCloseTest) { |
| 81 Notification n(GURL("http://www.google.com"), GURL("http://www.google.com"), | 84 Notification n(GURL("http://www.google.com"), GURL("http://www.google.com"), |
| 82 ASCIIToUTF16("http://www.google.com"), string16(), | 85 ASCIIToUTF16("http://www.google.com"), string16(), |
| 83 new NotificationObjectProxy(-1, -1, -1, false)); | 86 new NotificationObjectProxy(-1, -1, -1, false)); |
| 84 scoped_ptr<Balloon> balloon( | 87 scoped_ptr<Balloon> balloon( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 107 | 110 |
| 108 [controller showWindow:nil]; | 111 [controller showWindow:nil]; |
| 109 | 112 |
| 110 EXPECT_TRUE([controller desiredTotalWidth] > 100); | 113 EXPECT_TRUE([controller desiredTotalWidth] > 100); |
| 111 EXPECT_TRUE([controller desiredTotalHeight] > 100); | 114 EXPECT_TRUE([controller desiredTotalHeight] > 100); |
| 112 | 115 |
| 113 [controller closeBalloon:YES]; | 116 [controller closeBalloon:YES]; |
| 114 } | 117 } |
| 115 | 118 |
| 116 } | 119 } |
| OLD | NEW |