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

Side by Side Diff: content/shell/browser/shell_mojo_test_utils_android.cc

Issue 641703002: Rewrite the Android implementation of BatteryMonitor directly in Java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@battery-status-api-to-mojo
Patch Set: Address Torne's comment. Created 6 years 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 "content/shell/browser/shell_mojo_test_utils_android.h" 5 #include "content/shell/browser/shell_mojo_test_utils_android.h"
6 6
7 #include "base/memory/scoped_vector.h" 7 #include "base/memory/scoped_vector.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/browser/mojo/service_registry_android.h" 10 #include "content/browser/mojo/service_registry_android.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 registry_a->BindRemoteServiceProvider(handle_a.Pass()); 50 registry_a->BindRemoteServiceProvider(handle_a.Pass());
51 registry_b->BindRemoteServiceProvider(handle_b.Pass()); 51 registry_b->BindRemoteServiceProvider(handle_b.Pass());
52 52
53 content::ServiceRegistryAndroid* wrapper_a = 53 content::ServiceRegistryAndroid* wrapper_a =
54 new ServiceRegistryAndroid(registry_a); 54 new ServiceRegistryAndroid(registry_a);
55 test_environment->wrappers.push_back(wrapper_a); 55 test_environment->wrappers.push_back(wrapper_a);
56 content::ServiceRegistryAndroid* wrapper_b = 56 content::ServiceRegistryAndroid* wrapper_b =
57 new ServiceRegistryAndroid(registry_b); 57 new ServiceRegistryAndroid(registry_b);
58 test_environment->wrappers.push_back(wrapper_b); 58 test_environment->wrappers.push_back(wrapper_b);
59 59
60 return Java_ShellMojoTestUtils_makePair(env, 60 return Java_ShellMojoTestUtils_makePair(env, wrapper_a->GetObj().obj(),
61 wrapper_a->GetObjForTesting().obj(), 61 wrapper_b->GetObj().obj()).Release();
62 wrapper_b->GetObjForTesting().obj())
63 .Release();
64 } 62 }
65 63
66 static void RunLoop(JNIEnv* env, jclass jcaller, jlong timeout_ms) { 64 static void RunLoop(JNIEnv* env, jclass jcaller, jlong timeout_ms) {
67 base::MessageLoop::current()->PostDelayedTask( 65 base::MessageLoop::current()->PostDelayedTask(
68 FROM_HERE, 66 FROM_HERE,
69 base::MessageLoop::QuitClosure(), 67 base::MessageLoop::QuitClosure(),
70 base::TimeDelta::FromMilliseconds(timeout_ms)); 68 base::TimeDelta::FromMilliseconds(timeout_ms));
71 base::RunLoop run_loop; 69 base::RunLoop run_loop;
72 run_loop.Run(); 70 run_loop.Run();
73 } 71 }
74 72
75 bool RegisterShellMojoTestUtils(JNIEnv* env) { 73 bool RegisterShellMojoTestUtils(JNIEnv* env) {
76 return RegisterNativesImpl(env); 74 return RegisterNativesImpl(env);
77 } 75 }
78 76
79 } // namespace content 77 } // namespace content
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ServiceRegistrar.java ('k') | device/battery/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698