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 "chrome/test/base/browser_with_test_window_test.h" | 5 #include "chrome/test/base/browser_with_test_window_test.h" |
6 | 6 |
7 #include "chrome/browser/tabs/tab_strip_model.h" | 7 #include "chrome/browser/tabs/tab_strip_model.h" |
8 #include "chrome/browser/ui/browser_navigator.h" | 8 #include "chrome/browser/ui/browser_navigator.h" |
9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
12 #include "content/public/browser/navigation_controller.h" | 12 #include "content/public/browser/navigation_controller.h" |
13 #include "content/public/browser/navigation_entry.h" | 13 #include "content/public/browser/navigation_entry.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "content/public/common/page_transition_types.h" | 15 #include "content/public/common/page_transition_types.h" |
16 #include "content/test/test_renderer_host.h" | 16 #include "content/test/test_renderer_host.h" |
17 | 17 |
18 #if defined(USE_ASH) | 18 #if defined(USE_ASH) |
19 #include "ui/aura/test/test_screen.h" | 19 #include "ui/aura/test/test_screen.h" |
20 #endif | 20 #endif |
21 | 21 |
22 #if defined(USE_AURA) | 22 #if defined(USE_AURA) |
23 #include "ui/aura/env.h" | 23 #include "ui/aura/env.h" |
24 #include "ui/aura/monitor_manager.h" | 24 #include "ui/aura/monitor_manager.h" |
25 #include "ui/aura/root_window.h" | 25 #include "ui/aura/root_window.h" |
26 #include "ui/aura/test/single_monitor_manager.h" | 26 #include "ui/aura/single_monitor_manager.h" |
27 #include "ui/aura/test/test_activation_client.h" | 27 #include "ui/aura/test/test_activation_client.h" |
28 #include "ui/aura/test/test_stacking_client.h" | 28 #include "ui/aura/test/test_stacking_client.h" |
29 #endif | 29 #endif |
30 | 30 |
31 using content::BrowserThread; | 31 using content::BrowserThread; |
32 using content::NavigationController; | 32 using content::NavigationController; |
33 using content::RenderViewHost; | 33 using content::RenderViewHost; |
34 using content::RenderViewHostTester; | 34 using content::RenderViewHostTester; |
35 using content::WebContents; | 35 using content::WebContents; |
36 | 36 |
37 BrowserWithTestWindowTest::BrowserWithTestWindowTest() | 37 BrowserWithTestWindowTest::BrowserWithTestWindowTest() |
38 : ui_thread_(BrowserThread::UI, message_loop()), | 38 : ui_thread_(BrowserThread::UI, message_loop()), |
39 file_thread_(BrowserThread::FILE, message_loop()), | 39 file_thread_(BrowserThread::FILE, message_loop()), |
40 file_user_blocking_thread_( | 40 file_user_blocking_thread_( |
41 BrowserThread::FILE_USER_BLOCKING, message_loop()) { | 41 BrowserThread::FILE_USER_BLOCKING, message_loop()) { |
42 } | 42 } |
43 | 43 |
44 void BrowserWithTestWindowTest::SetUp() { | 44 void BrowserWithTestWindowTest::SetUp() { |
45 testing::Test::SetUp(); | 45 testing::Test::SetUp(); |
46 | 46 |
47 profile_.reset(CreateProfile()); | 47 profile_.reset(CreateProfile()); |
48 browser_.reset(new Browser(Browser::TYPE_TABBED, profile())); | 48 browser_.reset(new Browser(Browser::TYPE_TABBED, profile())); |
49 window_.reset(new TestBrowserWindow(browser())); | 49 window_.reset(new TestBrowserWindow(browser())); |
50 browser_->SetWindowForTesting(window_.get()); | 50 browser_->SetWindowForTesting(window_.get()); |
51 #if defined(USE_AURA) | 51 #if defined(USE_AURA) |
52 aura::Env::GetInstance()->SetMonitorManager( | 52 aura::Env::GetInstance()->SetMonitorManager(new aura::SingleMonitorManager); |
53 new aura::test::SingleMonitorManager); | |
54 root_window_.reset(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()); | 53 root_window_.reset(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()); |
55 #if defined(USE_ASH) | 54 #if defined(USE_ASH) |
56 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); | 55 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); |
57 #endif // USE_ASH | 56 #endif // USE_ASH |
58 test_activation_client_.reset( | 57 test_activation_client_.reset( |
59 new aura::test::TestActivationClient(root_window_.get())); | 58 new aura::test::TestActivationClient(root_window_.get())); |
60 test_stacking_client_.reset( | 59 test_stacking_client_.reset( |
61 new aura::test::TestStackingClient(root_window_.get())); | 60 new aura::test::TestStackingClient(root_window_.get())); |
62 #endif // USE_AURA | 61 #endif // USE_AURA |
63 } | 62 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Make sure we close all tabs, otherwise Browser isn't happy in its | 148 // Make sure we close all tabs, otherwise Browser isn't happy in its |
150 // destructor. | 149 // destructor. |
151 browser()->CloseAllTabs(); | 150 browser()->CloseAllTabs(); |
152 browser_.reset(NULL); | 151 browser_.reset(NULL); |
153 window_.reset(NULL); | 152 window_.reset(NULL); |
154 } | 153 } |
155 | 154 |
156 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { | 155 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { |
157 return new TestingProfile(); | 156 return new TestingProfile(); |
158 } | 157 } |
OLD | NEW |