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

Side by Side Diff: content/public/test/test_utils.cc

Issue 2784493003: Consolidate JNI registrations for mojo system. (Closed)
Patch Set: Rebase only Created 3 years, 8 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 | « content/public/test/content_test_suite_base.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/public/test/test_utils.h" 5 #include "content/public/test/test_utils.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 15 matching lines...) Expand all
26 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
27 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
28 #include "content/public/common/process_type.h" 28 #include "content/public/common/process_type.h"
29 #include "content/public/test/test_launcher.h" 29 #include "content/public/test/test_launcher.h"
30 #include "content/public/test/test_service_manager_context.h" 30 #include "content/public/test/test_service_manager_context.h"
31 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
32 #include "url/url_util.h" 32 #include "url/url_util.h"
33 33
34 #if defined(OS_ANDROID) 34 #if defined(OS_ANDROID)
35 #include "content/browser/android/browser_jni_registrar.h" 35 #include "content/browser/android/browser_jni_registrar.h"
36 #include "mojo/android/system/mojo_jni_registrar.h"
36 #endif 37 #endif
37 38
38 namespace content { 39 namespace content {
39 40
40 namespace { 41 namespace {
41 42
42 // Number of times to repost a Quit task so that the MessageLoop finishes up 43 // Number of times to repost a Quit task so that the MessageLoop finishes up
43 // pending tasks and tasks posted by those pending tasks without risking the 44 // pending tasks and tasks posted by those pending tasks without risking the
44 // potential hang behavior of MessageLoop::QuitWhenIdle. 45 // potential hang behavior of MessageLoop::QuitWhenIdle.
45 // The criteria for choosing this number: it should be high enough to make the 46 // The criteria for choosing this number: it should be high enough to make the
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 command_line->AppendSwitch(switches::kSitePerProcess); 196 command_line->AppendSwitch(switches::kSitePerProcess);
196 } 197 }
197 198
198 void ResetSchemesAndOriginsWhitelist() { 199 void ResetSchemesAndOriginsWhitelist() {
199 url::Shutdown(); 200 url::Shutdown();
200 RegisterContentSchemes(false); 201 RegisterContentSchemes(false);
201 url::Initialize(); 202 url::Initialize();
202 } 203 }
203 204
204 #if defined(OS_ANDROID) 205 #if defined(OS_ANDROID)
205 // Registers content/browser JNI bindings necessary for some types of tests. 206 // Registers content/browser and mojo JNI bindings necessary for some types of
207 // tests.
206 bool RegisterJniForTesting(JNIEnv* env) { 208 bool RegisterJniForTesting(JNIEnv* env) {
207 return content::android::RegisterBrowserJni(env); 209 return mojo::android::RegisterSystemJni(env) &&
210 content::android::RegisterBrowserJni(env);
208 } 211 }
209 #endif 212 #endif
210 213
211 MessageLoopRunner::MessageLoopRunner(QuitMode quit_mode) 214 MessageLoopRunner::MessageLoopRunner(QuitMode quit_mode)
212 : quit_mode_(quit_mode), loop_running_(false), quit_closure_called_(false) { 215 : quit_mode_(quit_mode), loop_running_(false), quit_closure_called_(false) {
213 } 216 }
214 217
215 MessageLoopRunner::~MessageLoopRunner() = default; 218 MessageLoopRunner::~MessageLoopRunner() = default;
216 219
217 void MessageLoopRunner::Run() { 220 void MessageLoopRunner::Run() {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 391
389 void WebContentsDestroyedWatcher::Wait() { 392 void WebContentsDestroyedWatcher::Wait() {
390 run_loop_.Run(); 393 run_loop_.Run();
391 } 394 }
392 395
393 void WebContentsDestroyedWatcher::WebContentsDestroyed() { 396 void WebContentsDestroyedWatcher::WebContentsDestroyed() {
394 run_loop_.Quit(); 397 run_loop_.Quit();
395 } 398 }
396 399
397 } // namespace content 400 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/content_test_suite_base.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698