OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/notifications/notification_object_proxy.h" | 10 #include "chrome/browser/notifications/notification_object_proxy.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 12 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
13 #include "chrome/browser/ui/cocoa/notifications/balloon_controller.h" | 13 #include "chrome/browser/ui/cocoa/notifications/balloon_controller.h" |
14 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 14 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 15 #include "chrome/test/base/test_browser_window.h" |
15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
16 #include "content/public/test/test_browser_thread.h" | 17 #include "content/public/test/test_browser_thread.h" |
17 | 18 |
18 using content::BrowserThread; | 19 using content::BrowserThread; |
19 | 20 |
20 // Subclass balloon controller and mock out the initialization of the RVH. | 21 // Subclass balloon controller and mock out the initialization of the RVH. |
21 @interface TestBalloonController : BalloonController { | 22 @interface TestBalloonController : BalloonController { |
22 } | 23 } |
23 - (void)initializeHost; | 24 - (void)initializeHost; |
24 @end | 25 @end |
(...skipping 30 matching lines...) Expand all Loading... |
55 ui_thread_(BrowserThread::UI, MessageLoop::current()), | 56 ui_thread_(BrowserThread::UI, MessageLoop::current()), |
56 file_user_blocking_thread_( | 57 file_user_blocking_thread_( |
57 BrowserThread::FILE_USER_BLOCKING, MessageLoop::current()), | 58 BrowserThread::FILE_USER_BLOCKING, MessageLoop::current()), |
58 io_thread_(BrowserThread::IO, MessageLoop::current()) { | 59 io_thread_(BrowserThread::IO, MessageLoop::current()) { |
59 } | 60 } |
60 | 61 |
61 virtual void SetUp() { | 62 virtual void SetUp() { |
62 ChromeRenderViewHostTestHarness::SetUp(); | 63 ChromeRenderViewHostTestHarness::SetUp(); |
63 CocoaTest::BootstrapCocoa(); | 64 CocoaTest::BootstrapCocoa(); |
64 profile()->CreateRequestContext(); | 65 profile()->CreateRequestContext(); |
65 browser_.reset(new Browser(Browser::TYPE_TABBED, profile())); | 66 browser_.reset(chrome::CreateBrowserWithTestWindowForProfile(profile())); |
66 collection_.reset(new MockBalloonCollection()); | 67 collection_.reset(new MockBalloonCollection()); |
67 } | 68 } |
68 | 69 |
69 virtual void TearDown() { | 70 virtual void TearDown() { |
70 collection_.reset(); | 71 collection_.reset(); |
71 browser_.reset(); | 72 browser_.reset(); |
72 MessageLoop::current()->RunAllPending(); | 73 MessageLoop::current()->RunAllPending(); |
73 ChromeRenderViewHostTestHarness::TearDown(); | 74 ChromeRenderViewHostTestHarness::TearDown(); |
74 } | 75 } |
75 | 76 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 112 |
112 [controller showWindow:nil]; | 113 [controller showWindow:nil]; |
113 | 114 |
114 EXPECT_TRUE([controller desiredTotalWidth] > 100); | 115 EXPECT_TRUE([controller desiredTotalWidth] > 100); |
115 EXPECT_TRUE([controller desiredTotalHeight] > 100); | 116 EXPECT_TRUE([controller desiredTotalHeight] > 100); |
116 | 117 |
117 [controller closeBalloon:YES]; | 118 [controller closeBalloon:YES]; |
118 } | 119 } |
119 | 120 |
120 } | 121 } |
OLD | NEW |