| 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 "chrome/test/browser_with_test_window_test.h" | 5 #include "chrome/test/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/testing_profile.h" | 15 #include "chrome/test/testing_profile.h" |
| 16 #include "content/browser/tab_contents/navigation_controller.h" | 16 #include "content/browser/tab_contents/navigation_controller.h" |
| 17 #include "content/browser/tab_contents/navigation_entry.h" | 17 #include "content/browser/tab_contents/navigation_entry.h" |
| 18 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
| 19 #include "content/common/content_client.h" | |
| 20 #include "content/common/page_transition_types.h" | 19 #include "content/common/page_transition_types.h" |
| 21 | 20 |
| 22 BrowserWithTestWindowTest::BrowserWithTestWindowTest() | 21 BrowserWithTestWindowTest::BrowserWithTestWindowTest() |
| 23 : ui_thread_(BrowserThread::UI, message_loop()), | 22 : ui_thread_(BrowserThread::UI, message_loop()), |
| 24 file_thread_(BrowserThread::FILE, message_loop()), | 23 file_thread_(BrowserThread::FILE, message_loop()), |
| 25 rph_factory_(), | 24 rph_factory_(), |
| 26 rvh_factory_(&rph_factory_) { | 25 rvh_factory_(&rph_factory_) { |
| 27 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
| 28 OleInitialize(NULL); | 27 OleInitialize(NULL); |
| 29 #endif | 28 #endif |
| 30 } | 29 } |
| 31 | 30 |
| 32 void BrowserWithTestWindowTest::SetUp() { | 31 void BrowserWithTestWindowTest::SetUp() { |
| 33 TestingBrowserProcessTest::SetUp(); | 32 TestingBrowserProcessTest::SetUp(); |
| 34 | 33 |
| 35 profile_.reset(CreateProfile()); | 34 profile_.reset(CreateProfile()); |
| 36 content::GetContentClient()->set_browser(&browser_client_); | |
| 37 browser_.reset(new Browser(Browser::TYPE_NORMAL, profile())); | 35 browser_.reset(new Browser(Browser::TYPE_NORMAL, profile())); |
| 38 window_.reset(new TestBrowserWindow(browser())); | 36 window_.reset(new TestBrowserWindow(browser())); |
| 39 browser_->set_window(window_.get()); | 37 browser_->set_window(window_.get()); |
| 40 } | 38 } |
| 41 | 39 |
| 42 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { | 40 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { |
| 43 // A Task is leaked if we don't destroy everything, then run the message | 41 // A Task is leaked if we don't destroy everything, then run the message |
| 44 // loop. | 42 // loop. |
| 45 DestroyBrowser(); | 43 DestroyBrowser(); |
| 46 profile_.reset(NULL); | 44 profile_.reset(NULL); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // Make sure we close all tabs, otherwise Browser isn't happy in its | 105 // Make sure we close all tabs, otherwise Browser isn't happy in its |
| 108 // destructor. | 106 // destructor. |
| 109 browser()->CloseAllTabs(); | 107 browser()->CloseAllTabs(); |
| 110 browser_.reset(NULL); | 108 browser_.reset(NULL); |
| 111 window_.reset(NULL); | 109 window_.reset(NULL); |
| 112 } | 110 } |
| 113 | 111 |
| 114 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { | 112 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { |
| 115 return new TestingProfile(); | 113 return new TestingProfile(); |
| 116 } | 114 } |
| OLD | NEW |