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

Side by Side Diff: athena/test/base/athena_test_base.cc

Issue 863033002: Delete athena/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « athena/test/base/athena_test_base.h ('k') | athena/test/base/athena_test_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "athena/test/base/athena_test_base.h"
6
7 #include "athena/env/public/athena_env.h"
8 #include "athena/test/base/athena_test_helper.h"
9 #include "ui/aura/test/event_generator_delegate_aura.h"
10 #include "ui/compositor/test/context_factories_for_test.h"
11
12 #if defined(USE_X11)
13 #include "ui/aura/window_tree_host_x11.h"
14 #endif
15
16 namespace athena {
17 namespace test {
18
19 AthenaTestBase::AthenaTestBase()
20 : setup_called_(false), teardown_called_(false) {
21 }
22
23 AthenaTestBase::~AthenaTestBase() {
24 CHECK(setup_called_)
25 << "You have overridden SetUp but never called super class's SetUp";
26 CHECK(teardown_called_)
27 << "You have overridden TearDown but never called super class's TearDown";
28 }
29
30 void AthenaTestBase::SetUp() {
31 setup_called_ = true;
32 testing::Test::SetUp();
33
34 // The ContextFactory must exist before any Compositors are created.
35 bool enable_pixel_output = false;
36 ui::ContextFactory* context_factory =
37 ui::InitializeContextFactoryForTests(enable_pixel_output);
38
39 helper_.reset(new AthenaTestHelper(&message_loop_));
40 #if defined(USE_X11)
41 aura::test::SetUseOverrideRedirectWindowByDefault(true);
42 #endif
43 aura::test::InitializeAuraEventGeneratorDelegate();
44 helper_->SetUp(context_factory);
45 }
46
47 void AthenaTestBase::TearDown() {
48 AthenaEnv::Get()->OnTerminating();
49
50 teardown_called_ = true;
51
52 // Flush the message loop because we have pending release tasks
53 // and these tasks if un-executed would upset Valgrind.
54 RunAllPendingInMessageLoop();
55
56 helper_->TearDown();
57 ui::TerminateContextFactoryForTests();
58 testing::Test::TearDown();
59 }
60
61 void AthenaTestBase::RunAllPendingInMessageLoop() {
62 helper_->RunAllPendingInMessageLoop();
63 }
64
65 } // namespace test
66 } // namespace athena
OLDNEW
« no previous file with comments | « athena/test/base/athena_test_base.h ('k') | athena/test/base/athena_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698