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

Side by Side Diff: mojo/public/cpp/application/lib/application_test_base.cc

Issue 795593004: Update mojo sdk to rev cc531b32182099a5a034a99daff35ed5d38a61c8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More workarounds for MSVC 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
OLDNEW
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/system/message_pipe.h" 10 #include "mojo/public/cpp/system/message_pipe.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 ApplicationTestBase::~ApplicationTestBase() { 52 ApplicationTestBase::~ApplicationTestBase() {
53 } 53 }
54 54
55 ApplicationDelegate* ApplicationTestBase::GetApplicationDelegate() { 55 ApplicationDelegate* ApplicationTestBase::GetApplicationDelegate() {
56 return &default_application_delegate_; 56 return &default_application_delegate_;
57 } 57 }
58 58
59 void ApplicationTestBase::SetUpWithArgs(const Array<String>& args) { 59 void ApplicationTestBase::SetUpWithArgs(const Array<String>& args) {
60 // A run loop is needed for ApplicationImpl initialization and communication. 60 // A run loop is recommended for ApplicationImpl initialization and
61 Environment::InstantiateDefaultRunLoop(); 61 // communication.
62 if (ShouldCreateDefaultRunLoop())
63 Environment::InstantiateDefaultRunLoop();
62 64
63 // New applications are constructed for each test to avoid persisting state. 65 // New applications are constructed for each test to avoid persisting state.
64 application_impl_ = new ApplicationImpl(GetApplicationDelegate(), 66 application_impl_ = new ApplicationImpl(GetApplicationDelegate(),
65 PassShellHandle()); 67 PassShellHandle());
66 68
67 // Fake application initialization with the given command line arguments. 69 // Fake application initialization with the given command line arguments.
68 application_impl_->Initialize(args.Clone()); 70 application_impl_->Initialize(args.Clone());
69 } 71 }
70 72
71 void ApplicationTestBase::SetUp() { 73 void ApplicationTestBase::SetUp() {
72 SetUpWithArgs(Args()); 74 SetUpWithArgs(Args());
73 } 75 }
74 76
75 void ApplicationTestBase::TearDown() { 77 void ApplicationTestBase::TearDown() {
76 SetShellHandle(application_impl_->UnbindShell()); 78 SetShellHandle(application_impl_->UnbindShell());
77 delete application_impl_; 79 delete application_impl_;
78 Environment::DestroyDefaultRunLoop(); 80 if (ShouldCreateDefaultRunLoop())
81 Environment::DestroyDefaultRunLoop();
82 }
83
84 bool ApplicationTestBase::ShouldCreateDefaultRunLoop() {
85 return true;
79 } 86 }
80 87
81 } // namespace test 88 } // namespace test
82 } // namespace mojo 89 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/application/application_test_base.h ('k') | mojo/public/cpp/bindings/interface_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698