| 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 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 void BrowserWithTestWindowTest::SetUp() { | 43 void BrowserWithTestWindowTest::SetUp() { |
| 44 testing::Test::SetUp(); | 44 testing::Test::SetUp(); |
| 45 | 45 |
| 46 profile_.reset(CreateProfile()); | 46 profile_.reset(CreateProfile()); |
| 47 browser_.reset(new Browser(Browser::TYPE_TABBED, profile())); | 47 browser_.reset(new Browser(Browser::TYPE_TABBED, profile())); |
| 48 window_.reset(new TestBrowserWindow(browser())); | 48 window_.reset(new TestBrowserWindow(browser())); |
| 49 browser_->SetWindowForTesting(window_.get()); | 49 browser_->SetWindowForTesting(window_.get()); |
| 50 #if defined(USE_AURA) | 50 #if defined(USE_AURA) |
| 51 aura::RootWindow* root_window = aura::RootWindow::GetInstance(); | 51 root_window_.reset(new aura::RootWindow); |
| 52 test_activation_client_.reset( | 52 test_activation_client_.reset( |
| 53 new aura::test::TestActivationClient(root_window)); | 53 new aura::test::TestActivationClient(root_window_.get())); |
| 54 test_stacking_client_.reset( | 54 test_stacking_client_.reset( |
| 55 new aura::test::TestStackingClient(root_window)); | 55 new aura::test::TestStackingClient(root_window_.get())); |
| 56 #endif | 56 #endif |
| 57 } | 57 } |
| 58 | 58 |
| 59 void BrowserWithTestWindowTest::TearDown() { | 59 void BrowserWithTestWindowTest::TearDown() { |
| 60 testing::Test::TearDown(); | 60 testing::Test::TearDown(); |
| 61 #if defined(USE_AURA) | 61 #if defined(USE_AURA) |
| 62 test_activation_client_.reset(); | 62 test_activation_client_.reset(); |
| 63 test_stacking_client_.reset(); | 63 test_stacking_client_.reset(); |
| 64 aura::RootWindow::DeleteInstance(); | 64 root_window_.reset(); |
| 65 #endif | 65 #endif |
| 66 } | 66 } |
| 67 | 67 |
| 68 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { | 68 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { |
| 69 // A Task is leaked if we don't destroy everything, then run the message | 69 // A Task is leaked if we don't destroy everything, then run the message |
| 70 // loop. | 70 // loop. |
| 71 DestroyBrowser(); | 71 DestroyBrowser(); |
| 72 profile_.reset(NULL); | 72 profile_.reset(NULL); |
| 73 | 73 |
| 74 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 74 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // Make sure we close all tabs, otherwise Browser isn't happy in its | 153 // Make sure we close all tabs, otherwise Browser isn't happy in its |
| 154 // destructor. | 154 // destructor. |
| 155 browser()->CloseAllTabs(); | 155 browser()->CloseAllTabs(); |
| 156 browser_.reset(NULL); | 156 browser_.reset(NULL); |
| 157 window_.reset(NULL); | 157 window_.reset(NULL); |
| 158 } | 158 } |
| 159 | 159 |
| 160 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { | 160 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { |
| 161 return new TestingProfile(); | 161 return new TestingProfile(); |
| 162 } | 162 } |
| OLD | NEW |