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

Unified Diff: blimp/client/app/android/javatests/src/org/chromium/blimp/BlimpNativeInstrumentationTestCase.java

Issue 2493333002: Move Java Blimp shell code to app subpackage (Closed)
Patch Set: Merge branch 'refs/heads/master' into blimp-shell-integration Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: blimp/client/app/android/javatests/src/org/chromium/blimp/BlimpNativeInstrumentationTestCase.java
diff --git a/blimp/client/app/android/javatests/src/org/chromium/blimp/BlimpNativeInstrumentationTestCase.java b/blimp/client/app/android/javatests/src/org/chromium/blimp/BlimpNativeInstrumentationTestCase.java
deleted file mode 100644
index 5a9e49921f185dd26fb6b1d9efc4466b25d203ad..0000000000000000000000000000000000000000
--- a/blimp/client/app/android/javatests/src/org/chromium/blimp/BlimpNativeInstrumentationTestCase.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.blimp;
-
-import android.test.InstrumentationTestCase;
-
-import org.chromium.base.ThreadUtils;
-import org.chromium.base.library_loader.ProcessInitException;
-
-import java.util.concurrent.Semaphore;
-
-/**
- * Base class for loading native library in tests. The setUp() methods must be invoked, and
- * subclasses can call {@link #waitUntilNativeIsReady()} in the start of each test-method.
- */
-public class BlimpNativeInstrumentationTestCase extends InstrumentationTestCase {
- private final Semaphore mNativeReadySemaphore = new Semaphore(0);
- private boolean mSuccess = false;
-
- @Override
- public void setUp() throws ProcessInitException {
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
- @Override
- public void run() {
- try {
- BlimpLibraryLoader.startAsync(new BlimpLibraryLoader.Callback() {
- @Override
- public void onStartupComplete(boolean success) {
- mSuccess = success;
- mNativeReadySemaphore.release();
- }
- });
- } catch (ProcessInitException e) {
- throw new RuntimeException("Failed to initialize process.");
- }
- }
- });
- }
-
- /**
- * Blocks until the native library startup is complete. If the startup dit not complete
- * successfully, this method throws a RuntimeException, otherwise it does nothing.
- * This method should be called in the start of any test method that requires native to be
- * successfully loaded.
- */
- protected final void waitUntilNativeIsReady() throws InterruptedException {
- mNativeReadySemaphore.acquire();
- if (!mSuccess) throw new RuntimeException("Native startup failed");
- }
-}

Powered by Google App Engine
This is Rietveld 408576698