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

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

Issue 301593004: Athena unittests framework (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix deps Created 6 years, 6 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
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/athena_test_base.h"
6
7 #include "athena/test/athena_test_helper.h"
8 #include "ui/compositor/test/context_factories_for_test.h"
9
10 namespace athena {
11 namespace test {
12
13 AthenaTestBase::AthenaTestBase()
14 : setup_called_(false), teardown_called_(false) {
15 }
16
17 AthenaTestBase::~AthenaTestBase() {
18 CHECK(setup_called_)
19 << "You have overridden SetUp but never called super class's SetUp";
20 CHECK(teardown_called_)
21 << "You have overridden TearDown but never called super class's TearDown";
22 }
23
24 void AthenaTestBase::SetUp() {
25 setup_called_ = true;
26 testing::Test::SetUp();
27
28 // The ContextFactory must exist before any Compositors are created.
29 bool enable_pixel_output = false;
30 ui::ContextFactory* context_factory =
31 ui::InitializeContextFactoryForTests(enable_pixel_output);
32
33 helper_.reset(new AthenaTestHelper(&message_loop_));
34 helper_->SetUp(context_factory);
35 }
36
37 void AthenaTestBase::TearDown() {
38 teardown_called_ = true;
39
40 // Flush the message loop because we have pending release tasks
41 // and these tasks if un-executed would upset Valgrind.
42 RunAllPendingInMessageLoop();
43
44 helper_->TearDown();
45 ui::TerminateContextFactoryForTests();
46 testing::Test::TearDown();
47 }
48
49 void AthenaTestBase::RunAllPendingInMessageLoop() {
50 helper_->RunAllPendingInMessageLoop();
51 }
52
53 } // namespace test
54 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698