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

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

Issue 296053009: Makes Env contain a ContextFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: foo Created 6 years, 7 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_helper.h ('k') | ui/aura/window_tree_host.cc » ('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_helper.h" 5 #include "ui/aura/test/aura_test_helper.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/default_capture_client.h" 10 #include "ui/aura/client/default_capture_client.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #endif 45 #endif
46 } 46 }
47 47
48 AuraTestHelper::~AuraTestHelper() { 48 AuraTestHelper::~AuraTestHelper() {
49 CHECK(setup_called_) 49 CHECK(setup_called_)
50 << "AuraTestHelper::SetUp() never called."; 50 << "AuraTestHelper::SetUp() never called.";
51 CHECK(teardown_called_) 51 CHECK(teardown_called_)
52 << "AuraTestHelper::TearDown() never called."; 52 << "AuraTestHelper::TearDown() never called.";
53 } 53 }
54 54
55 void AuraTestHelper::SetUp() { 55 void AuraTestHelper::SetUp(ui::ContextFactory* context_factory) {
56 setup_called_ = true; 56 setup_called_ = true;
57 57
58 Env::CreateInstance(true); 58 Env::CreateInstance(true);
59 Env::GetInstance()->set_context_factory(context_factory);
59 // Unit tests generally don't want to query the system, rather use the state 60 // Unit tests generally don't want to query the system, rather use the state
60 // from RootWindow. 61 // from RootWindow.
61 EnvTestHelper(Env::GetInstance()).SetInputStateLookup( 62 EnvTestHelper(Env::GetInstance()).SetInputStateLookup(
62 scoped_ptr<InputStateLookup>()); 63 scoped_ptr<InputStateLookup>());
63 64
64 ui::InitializeInputMethodForTesting(); 65 ui::InitializeInputMethodForTesting();
65 66
66 test_screen_.reset(TestScreen::Create()); 67 test_screen_.reset(TestScreen::Create());
67 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); 68 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
68 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); 69 host_.reset(test_screen_->CreateHostForPrimaryDisplay());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 105
105 void AuraTestHelper::RunAllPendingInMessageLoop() { 106 void AuraTestHelper::RunAllPendingInMessageLoop() {
106 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them 107 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
107 // use run_loop.QuitClosure(). 108 // use run_loop.QuitClosure().
108 base::RunLoop run_loop; 109 base::RunLoop run_loop;
109 run_loop.RunUntilIdle(); 110 run_loop.RunUntilIdle();
110 } 111 }
111 112
112 } // namespace test 113 } // namespace test
113 } // namespace aura 114 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/aura_test_helper.h ('k') | ui/aura/window_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698