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