| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.content_shell; | |
| 6 | |
| 7 import org.chromium.base.annotations.CalledByNative; | |
| 8 import org.chromium.base.annotations.JNINamespace; | |
| 9 import org.chromium.content.browser.InterfaceProvider; | |
| 10 import org.chromium.content.browser.InterfaceRegistry; | |
| 11 import org.chromium.mojo.system.Pair; | |
| 12 | |
| 13 /** | |
| 14 * Test hooks for shell InterfaceRegistry/Provider support in the browser. | |
| 15 * See http://crbug.com/415945. | |
| 16 */ | |
| 17 @JNINamespace("content") | |
| 18 public class ShellMojoTestUtils { | |
| 19 public static long setupTestEnvironment() { | |
| 20 return nativeSetupTestEnvironment(); | |
| 21 } | |
| 22 | |
| 23 public static void tearDownTestEnvironment(long testEnvironment) { | |
| 24 nativeTearDownTestEnvironment(testEnvironment); | |
| 25 } | |
| 26 | |
| 27 /** | |
| 28 * Returns an InterfaceRegistry and an InterfaceProvider bound to it. | |
| 29 */ | |
| 30 public static Pair<InterfaceRegistry, InterfaceProvider> createInterfaceRegi
stryAndProvider( | |
| 31 long testEnvironment) { | |
| 32 // Declaring parametrized return type for nativeCreateInterfaceRegistryA
ndProvider() breaks | |
| 33 // the JNI generator. TODO(ppi): support parametrized return types in th
e JNI generator. | |
| 34 @SuppressWarnings("unchecked") | |
| 35 Pair<InterfaceRegistry, InterfaceProvider> pair = | |
| 36 nativeCreateInterfaceRegistryAndProvider(testEnvironment); | |
| 37 return pair; | |
| 38 } | |
| 39 | |
| 40 public static void runLoop(long timeoutMs) { | |
| 41 nativeRunLoop(timeoutMs); | |
| 42 } | |
| 43 | |
| 44 @CalledByNative | |
| 45 public static Pair makePair(InterfaceRegistry registry, InterfaceProvider pr
ovider) { | |
| 46 return new Pair<InterfaceRegistry, InterfaceProvider>(registry, provider
); | |
| 47 } | |
| 48 | |
| 49 private static native long nativeSetupTestEnvironment(); | |
| 50 private static native void nativeTearDownTestEnvironment(long testEnvironmen
t); | |
| 51 private static native Pair nativeCreateInterfaceRegistryAndProvider(long tes
tEnvironment); | |
| 52 private static native void nativeRunLoop(long timeoutMs); | |
| 53 } | |
| OLD | NEW |