OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "mojo/public/cpp/application/application_test_base.h" | 5 #include "mojo/public/cpp/application/application_test_base.h" |
6 | 6 |
7 #include "mojo/public/cpp/application/application_delegate.h" | 7 #include "mojo/public/cpp/application/application_delegate.h" |
8 #include "mojo/public/cpp/application/application_impl.h" | 8 #include "mojo/public/cpp/application/application_impl.h" |
9 #include "mojo/public/cpp/environment/environment.h" | 9 #include "mojo/public/cpp/environment/environment.h" |
10 #include "mojo/public/cpp/environment/logging.h" | 10 #include "mojo/public/cpp/environment/logging.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 ApplicationTestBase::~ApplicationTestBase() { | 40 ApplicationTestBase::~ApplicationTestBase() { |
41 } | 41 } |
42 | 42 |
43 void ApplicationTestBase::SetUp() { | 43 void ApplicationTestBase::SetUp() { |
44 // A run loop is needed for ApplicationImpl initialization and communication. | 44 // A run loop is needed for ApplicationImpl initialization and communication. |
45 Environment::InstantiateDefaultRunLoop(); | 45 Environment::InstantiateDefaultRunLoop(); |
46 | 46 |
47 // New applications are constructed for each test to avoid persisting state. | 47 // New applications are constructed for each test to avoid persisting state. |
48 application_impl_ = | 48 application_impl_ = new ApplicationImpl(GetApplicationDelegate(), |
49 new ApplicationImpl(GetApplicationDelegate(), PassShellHandle()); | 49 PassShellHandle()); |
50 | 50 |
51 // Fake application initialization with the given command line arguments. | 51 // Fake application initialization with the given command line arguments. |
52 application_impl_->Initialize(args_.Clone()); | 52 application_impl_->Initialize(args_.Clone()); |
53 } | 53 } |
54 | 54 |
55 void ApplicationTestBase::TearDown() { | 55 void ApplicationTestBase::TearDown() { |
56 SetShellHandle(application_impl_->UnbindShell()); | 56 SetShellHandle(application_impl_->UnbindShell()); |
57 delete application_impl_; | 57 delete application_impl_; |
58 Environment::DestroyDefaultRunLoop(); | 58 Environment::DestroyDefaultRunLoop(); |
59 } | 59 } |
60 | 60 |
61 } // namespace test | 61 } // namespace test |
62 } // namespace mojo | 62 } // namespace mojo |
OLD | NEW |