Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: ui/aura/test/aura_test_base.cc

Issue 9535025: Remove the singleton instance get/delete methods from RootWindow (yay) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/test/aura_test_base.h ('k') | ui/views/test/views_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/aura/test/aura_test_base.h" 5 #include "ui/aura/test/aura_test_base.h"
6 6
7 #include "ui/aura/root_window.h" 7 #include "ui/aura/root_window.h"
8 #include "ui/aura/test/test_stacking_client.h" 8 #include "ui/aura/test/test_stacking_client.h"
9 9
10 namespace aura { 10 namespace aura {
11 namespace test { 11 namespace test {
12 12
13 AuraTestBase::AuraTestBase() : root_window_(RootWindow::GetInstance()) { 13 AuraTestBase::AuraTestBase() {
14 helper_.InitRootWindow(root_window_);
15 } 14 }
16 15
17 AuraTestBase::~AuraTestBase() { 16 AuraTestBase::~AuraTestBase() {
18 // Flush the message loop because we have pending release tasks
19 // and these tasks if un-executed would upset Valgrind.
20 helper_.RunAllPendingInMessageLoop(root_window_);
21
22 // Ensure that we don't use the previously-allocated static RootWindow object
23 // later -- on Linux, it holds a reference to our message loop's X connection.
24 RootWindow::DeleteInstance();
25 } 17 }
26 18
27 void AuraTestBase::SetUp() { 19 void AuraTestBase::SetUp() {
28 testing::Test::SetUp(); 20 testing::Test::SetUp();
21 root_window_.reset(new aura::RootWindow);
22 helper_.InitRootWindow(root_window());
29 helper_.SetUp(); 23 helper_.SetUp();
30 stacking_client_.reset(new TestStackingClient(root_window())); 24 stacking_client_.reset(new TestStackingClient(root_window()));
31 } 25 }
32 26
33 void AuraTestBase::TearDown() { 27 void AuraTestBase::TearDown() {
28 // Flush the message loop because we have pending release tasks
29 // and these tasks if un-executed would upset Valgrind.
30 RunAllPendingInMessageLoop();
31
34 stacking_client_.reset(); 32 stacking_client_.reset();
35 helper_.TearDown(); 33 helper_.TearDown();
34 root_window_.reset();
36 testing::Test::TearDown(); 35 testing::Test::TearDown();
37 } 36 }
38 37
39 void AuraTestBase::RunAllPendingInMessageLoop() { 38 void AuraTestBase::RunAllPendingInMessageLoop() {
40 helper_.RunAllPendingInMessageLoop(root_window_); 39 helper_.RunAllPendingInMessageLoop(root_window());
41 } 40 }
42 41
43 } // namespace test 42 } // namespace test
44 } // namespace aura 43 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/aura_test_base.h ('k') | ui/views/test/views_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698