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

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

Issue 1900903002: Fix content/shell including internals of content for service worker test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ios 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
« no previous file with comments | « content/shell/DEPS ('k') | media/mojo/interfaces/mojo_bindings.gyp » ('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 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/common/mojo/service_registry_impl.h"
13 #include "content/public/browser/android/service_registry_android.h" 12 #include "content/public/browser/android/service_registry_android.h"
13 #include "content/public/common/service_registry.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::ServiceRegistry> registries;
21 ScopedVector<content::ServiceRegistryAndroid> wrappers; 21 ScopedVector<content::ServiceRegistryAndroid> wrappers;
22 }; 22 };
23 23
24 } // namespace 24 } // namespace
25 25
26 namespace content { 26 namespace content {
27 27
28 static jlong SetupTestEnvironment(JNIEnv* env, 28 static jlong SetupTestEnvironment(JNIEnv* env,
29 const JavaParamRef<jclass>& jcaller) { 29 const JavaParamRef<jclass>& jcaller) {
30 return reinterpret_cast<intptr_t>(new TestEnvironment()); 30 return reinterpret_cast<intptr_t>(new TestEnvironment());
31 } 31 }
32 32
33 static void TearDownTestEnvironment(JNIEnv* env, 33 static void TearDownTestEnvironment(JNIEnv* env,
34 const JavaParamRef<jclass>& jcaller, 34 const JavaParamRef<jclass>& jcaller,
35 jlong test_environment) { 35 jlong test_environment) {
36 delete reinterpret_cast<TestEnvironment*>(test_environment); 36 delete reinterpret_cast<TestEnvironment*>(test_environment);
37 } 37 }
38 38
39 static ScopedJavaLocalRef<jobject> CreateServiceRegistryPair( 39 static ScopedJavaLocalRef<jobject> CreateServiceRegistryPair(
40 JNIEnv* env, 40 JNIEnv* env,
41 const JavaParamRef<jclass>& jcaller, 41 const JavaParamRef<jclass>& jcaller,
42 jlong native_test_environment) { 42 jlong native_test_environment) {
43 TestEnvironment* test_environment = 43 TestEnvironment* test_environment =
44 reinterpret_cast<TestEnvironment*>(native_test_environment); 44 reinterpret_cast<TestEnvironment*>(native_test_environment);
45 45
46 content::ServiceRegistryImpl* registry_a = new ServiceRegistryImpl(); 46 content::ServiceRegistry* registry_a = ServiceRegistry::Create();
47 test_environment->registries.push_back(registry_a); 47 test_environment->registries.push_back(registry_a);
48 content::ServiceRegistryImpl* registry_b = new ServiceRegistryImpl(); 48 content::ServiceRegistry* registry_b = ServiceRegistry::Create();
49 test_environment->registries.push_back(registry_b); 49 test_environment->registries.push_back(registry_b);
50 50
51 shell::mojom::InterfaceProviderPtr exposed_services_a; 51 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 shell::mojom::InterfaceProviderPtr exposed_services_b; 55 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
(...skipping 16 matching lines...) Expand all
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/shell/DEPS ('k') | media/mojo/interfaces/mojo_bindings.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698