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

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

Issue 1831173002: Scaffolding for Android implementation of PaymentRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo
Patch Set: thestig@ & esprehn@ comments Created 4 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
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 <utility> 7 #include <utility>
8 8
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "content/browser/mojo/service_registry_android.h"
13 #include "content/common/mojo/service_registry_impl.h" 12 #include "content/common/mojo/service_registry_impl.h"
13 #include "content/public/browser/android/service_registry_android.h"
14 #include "jni/ShellMojoTestUtils_jni.h" 14 #include "jni/ShellMojoTestUtils_jni.h"
15 15
16 namespace { 16 namespace {
17 17
18 struct TestEnvironment { 18 struct TestEnvironment {
19 base::MessageLoop message_loop; 19 base::MessageLoop message_loop;
20 ScopedVector<content::ServiceRegistryImpl> registries; 20 ScopedVector<content::ServiceRegistryImpl> registries;
21 ScopedVector<content::ServiceRegistryAndroid> wrappers; 21 ScopedVector<content::ServiceRegistryAndroid> wrappers;
22 }; 22 };
23 23
(...skipping 26 matching lines...) Expand all
50 50
51 mojo::shell::mojom::InterfaceProviderPtr exposed_services_a; 51 mojo::shell::mojom::InterfaceProviderPtr exposed_services_a;
52 registry_a->Bind(GetProxy(&exposed_services_a)); 52 registry_a->Bind(GetProxy(&exposed_services_a));
53 registry_b->BindRemoteServiceProvider(std::move(exposed_services_a)); 53 registry_b->BindRemoteServiceProvider(std::move(exposed_services_a));
54 54
55 mojo::shell::mojom::InterfaceProviderPtr exposed_services_b; 55 mojo::shell::mojom::InterfaceProviderPtr exposed_services_b;
56 registry_b->Bind(GetProxy(&exposed_services_b)); 56 registry_b->Bind(GetProxy(&exposed_services_b));
57 registry_a->BindRemoteServiceProvider(std::move(exposed_services_b)); 57 registry_a->BindRemoteServiceProvider(std::move(exposed_services_b));
58 58
59 content::ServiceRegistryAndroid* wrapper_a = 59 content::ServiceRegistryAndroid* wrapper_a =
60 new ServiceRegistryAndroid(registry_a); 60 ServiceRegistryAndroid::Create(registry_a).release();
61 test_environment->wrappers.push_back(wrapper_a); 61 test_environment->wrappers.push_back(wrapper_a);
62 content::ServiceRegistryAndroid* wrapper_b = 62 content::ServiceRegistryAndroid* wrapper_b =
63 new ServiceRegistryAndroid(registry_b); 63 ServiceRegistryAndroid::Create(registry_b).release();
64 test_environment->wrappers.push_back(wrapper_b); 64 test_environment->wrappers.push_back(wrapper_b);
65 65
66 return Java_ShellMojoTestUtils_makePair(env, wrapper_a->GetObj().obj(), 66 return Java_ShellMojoTestUtils_makePair(env, wrapper_a->GetObj().obj(),
67 wrapper_b->GetObj().obj()); 67 wrapper_b->GetObj().obj());
68 } 68 }
69 69
70 static void RunLoop(JNIEnv* env, 70 static void RunLoop(JNIEnv* env,
71 const JavaParamRef<jclass>& jcaller, 71 const JavaParamRef<jclass>& jcaller,
72 jlong timeout_ms) { 72 jlong timeout_ms) {
73 base::MessageLoop::current()->PostDelayedTask( 73 base::MessageLoop::current()->PostDelayedTask(
74 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 74 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
75 base::TimeDelta::FromMilliseconds(timeout_ms)); 75 base::TimeDelta::FromMilliseconds(timeout_ms));
76 base::RunLoop run_loop; 76 base::RunLoop run_loop;
77 run_loop.Run(); 77 run_loop.Run();
78 } 78 }
79 79
80 bool RegisterShellMojoTestUtils(JNIEnv* env) { 80 bool RegisterShellMojoTestUtils(JNIEnv* env) {
81 return RegisterNativesImpl(env); 81 return RegisterNativesImpl(env);
82 } 82 }
83 83
84 } // namespace content 84 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/android/service_registry_android.h ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698