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

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 Ben's comments, update GN build, polish. 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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,
61 wrapper_a->GetObjForTesting().obj(), 61 wrapper_a->GetObj().obj(),
62 wrapper_b->GetObjForTesting().obj()) 62 wrapper_b->GetObj().obj())
63 .Release(); 63 .Release();
64 } 64 }
65 65
66 static void RunLoop(JNIEnv* env, jclass jcaller, jlong timeout_ms) { 66 static void RunLoop(JNIEnv* env, jclass jcaller, jlong timeout_ms) {
67 base::MessageLoop::current()->PostDelayedTask( 67 base::MessageLoop::current()->PostDelayedTask(
68 FROM_HERE, 68 FROM_HERE,
69 base::MessageLoop::QuitClosure(), 69 base::MessageLoop::QuitClosure(),
70 base::TimeDelta::FromMilliseconds(timeout_ms)); 70 base::TimeDelta::FromMilliseconds(timeout_ms));
71 base::RunLoop run_loop; 71 base::RunLoop run_loop;
72 run_loop.Run(); 72 run_loop.Run();
73 } 73 }
74 74
75 bool RegisterShellMojoTestUtils(JNIEnv* env) { 75 bool RegisterShellMojoTestUtils(JNIEnv* env) {
76 return RegisterNativesImpl(env); 76 return RegisterNativesImpl(env);
77 } 77 }
78 78
79 } // namespace content 79 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698