| 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_AURA) | 18 #if defined(USE_AURA) |
| 19 #include "ui/aura/env.h" | |
| 20 #include "ui/aura/monitor_manager.h" | 19 #include "ui/aura/monitor_manager.h" |
| 21 #include "ui/aura/root_window.h" | 20 #include "ui/aura/root_window.h" |
| 22 #include "ui/aura/test/test_activation_client.h" | 21 #include "ui/aura/test/test_activation_client.h" |
| 23 #include "ui/aura/test/test_screen.h" | 22 #include "ui/aura/test/test_screen.h" |
| 24 #include "ui/aura/test/test_stacking_client.h" | 23 #include "ui/aura/test/test_stacking_client.h" |
| 25 #endif | 24 #endif |
| 26 | 25 |
| 27 using content::BrowserThread; | 26 using content::BrowserThread; |
| 28 using content::NavigationController; | 27 using content::NavigationController; |
| 29 using content::RenderViewHost; | 28 using content::RenderViewHost; |
| 30 using content::RenderViewHostTester; | 29 using content::RenderViewHostTester; |
| 31 using content::WebContents; | 30 using content::WebContents; |
| 32 | 31 |
| 33 BrowserWithTestWindowTest::BrowserWithTestWindowTest() | 32 BrowserWithTestWindowTest::BrowserWithTestWindowTest() |
| 34 : ui_thread_(BrowserThread::UI, message_loop()), | 33 : ui_thread_(BrowserThread::UI, message_loop()), |
| 35 file_thread_(BrowserThread::FILE, message_loop()), | 34 file_thread_(BrowserThread::FILE, message_loop()), |
| 36 file_user_blocking_thread_( | 35 file_user_blocking_thread_( |
| 37 BrowserThread::FILE_USER_BLOCKING, message_loop()) { | 36 BrowserThread::FILE_USER_BLOCKING, message_loop()) { |
| 38 } | 37 } |
| 39 | 38 |
| 40 void BrowserWithTestWindowTest::SetUp() { | 39 void BrowserWithTestWindowTest::SetUp() { |
| 41 testing::Test::SetUp(); | 40 testing::Test::SetUp(); |
| 42 | 41 |
| 43 profile_.reset(CreateProfile()); | 42 profile_.reset(CreateProfile()); |
| 44 browser_.reset(new Browser(Browser::TYPE_TABBED, profile())); | 43 browser_.reset(new Browser(Browser::TYPE_TABBED, profile())); |
| 45 window_.reset(new TestBrowserWindow(browser())); | 44 window_.reset(new TestBrowserWindow(browser())); |
| 46 browser_->SetWindowForTesting(window_.get()); | 45 browser_->SetWindowForTesting(window_.get()); |
| 47 #if defined(USE_AURA) | 46 #if defined(USE_AURA) |
| 48 root_window_.reset(aura::Env::GetInstance()->monitor_manager()-> | 47 root_window_.reset(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()); |
| 49 CreateRootWindowForPrimaryMonitor()); | |
| 50 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); | 48 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); |
| 51 test_activation_client_.reset( | 49 test_activation_client_.reset( |
| 52 new aura::test::TestActivationClient(root_window_.get())); | 50 new aura::test::TestActivationClient(root_window_.get())); |
| 53 test_stacking_client_.reset( | 51 test_stacking_client_.reset( |
| 54 new aura::test::TestStackingClient(root_window_.get())); | 52 new aura::test::TestStackingClient(root_window_.get())); |
| 55 #endif | 53 #endif |
| 56 } | 54 } |
| 57 | 55 |
| 58 void BrowserWithTestWindowTest::TearDown() { | 56 void BrowserWithTestWindowTest::TearDown() { |
| 59 testing::Test::TearDown(); | 57 testing::Test::TearDown(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Make sure we close all tabs, otherwise Browser isn't happy in its | 140 // Make sure we close all tabs, otherwise Browser isn't happy in its |
| 143 // destructor. | 141 // destructor. |
| 144 browser()->CloseAllTabs(); | 142 browser()->CloseAllTabs(); |
| 145 browser_.reset(NULL); | 143 browser_.reset(NULL); |
| 146 window_.reset(NULL); | 144 window_.reset(NULL); |
| 147 } | 145 } |
| 148 | 146 |
| 149 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { | 147 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { |
| 150 return new TestingProfile(); | 148 return new TestingProfile(); |
| 151 } | 149 } |
| OLD | NEW |