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

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

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 years, 10 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 <utility> 5 #include <utility>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "mojo/public/cpp/bindings/binding.h" 9 #include "mojo/public/cpp/bindings/binding.h"
10 #include "mojo/public/cpp/environment/environment.h" 10 #include "mojo/public/cpp/environment/environment.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Shut down our message pipes before exiting. 109 // Shut down our message pipes before exiting.
110 (void)g_application_request.PassMessagePipe(); 110 (void)g_application_request.PassMessagePipe();
111 g_shell.reset(); 111 g_shell.reset();
112 112
113 return (result == 0) ? MOJO_RESULT_OK : MOJO_RESULT_UNKNOWN; 113 return (result == 0) ? MOJO_RESULT_OK : MOJO_RESULT_UNKNOWN;
114 } 114 }
115 115
116 TestHelper::TestHelper(ApplicationDelegate* delegate) 116 TestHelper::TestHelper(ApplicationDelegate* delegate)
117 : application_impl_(new ApplicationImpl( 117 : application_impl_(new ApplicationImpl(
118 delegate == nullptr ? &default_application_delegate_ : delegate, 118 delegate == nullptr ? &default_application_delegate_ : delegate,
119 std::move(g_application_request))) { 119 std::move(g_application_request))),
120 url_(g_url) {
120 // Fake application initialization. 121 // Fake application initialization.
121 shell::mojom::Application* application = application_impl_.get(); 122 shell::mojom::Application* application = application_impl_.get();
122 application->Initialize(std::move(g_shell), g_url, g_id); 123 application->Initialize(std::move(g_shell), g_url, g_id);
123 } 124 }
124 125
125 TestHelper::~TestHelper() { 126 TestHelper::~TestHelper() {
126 // TODO: commented out until http://crbug.com/533107 is solved. 127 // TODO: commented out until http://crbug.com/533107 is solved.
127 // { 128 // {
128 // ApplicationImpl::TestApi test_api(application_impl_); 129 // ApplicationImpl::TestApi test_api(application_impl_);
129 // test_api.UnbindConnections(&g_application_request, &g_shell); 130 // test_api.UnbindConnections(&g_application_request, &g_shell);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (ShouldCreateDefaultRunLoop()) 165 if (ShouldCreateDefaultRunLoop())
165 Environment::DestroyDefaultRunLoop(); 166 Environment::DestroyDefaultRunLoop();
166 } 167 }
167 168
168 bool ApplicationTestBase::ShouldCreateDefaultRunLoop() { 169 bool ApplicationTestBase::ShouldCreateDefaultRunLoop() {
169 return true; 170 return true;
170 } 171 }
171 172
172 } // namespace test 173 } // namespace test
173 } // namespace mojo 174 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/lib/application_impl.cc ('k') | mojo/shell/public/cpp/lib/content_handler_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698