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

Unified Diff: components/devtools_bridge/test/android/javatests/src/org/chromium/components/devtools_bridge/GCDClientSessionTestingHost.java

Issue 1142463003: Remove devtools_bridge component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/devtools_bridge/test/android/javatests/src/org/chromium/components/devtools_bridge/GCDClientSessionTestingHost.java
diff --git a/components/devtools_bridge/test/android/javatests/src/org/chromium/components/devtools_bridge/GCDClientSessionTestingHost.java b/components/devtools_bridge/test/android/javatests/src/org/chromium/components/devtools_bridge/GCDClientSessionTestingHost.java
deleted file mode 100644
index c3fd83a756881d39f0021a954ac4afcd239f23a5..0000000000000000000000000000000000000000
--- a/components/devtools_bridge/test/android/javatests/src/org/chromium/components/devtools_bridge/GCDClientSessionTestingHost.java
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2014 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.components.devtools_bridge;
-
-import android.util.Log;
-
-import org.chromium.components.devtools_bridge.apiary.TestApiaryClientFactory;
-import org.chromium.components.devtools_bridge.commands.Command;
-import org.chromium.components.devtools_bridge.commands.CommandSender;
-
-import java.io.IOException;
-import java.util.Random;
-
-/**
- * Helper class which handles a client session in manual tests. Connects to a
- * remote server with GCD.
- */
-public class GCDClientSessionTestingHost {
- private static final String TAG = "GCDClientSessionTestingHost";
- private static final Random sRandom = new Random();
-
- private final TestApiaryClientFactory mClientFactory;
- private final SessionDependencyFactory mFactory;
- private final LocalSessionBridge.ThreadedExecutor mIOExecutor;
- private final ClientSessionTestingHost mBase;
- private final String mOAuthToken;
- private final String mRemoteInstanceId;
-
- private volatile boolean mStarted;
-
- public GCDClientSessionTestingHost(
- String oAuthToken, String socketName, String remoteInstanceId) throws IOException {
- mClientFactory = new TestApiaryClientFactory();
- mFactory = SessionDependencyFactory.newInstance();
- mIOExecutor = new LocalSessionBridge.ThreadedExecutor();
-
- String sessionId = Integer.toString(sRandom.nextInt());
-
- mBase = new ClientSessionTestingHost(
- mFactory, new ServerProxy(remoteInstanceId), mIOExecutor, sessionId, socketName);
-
- mOAuthToken = oAuthToken;
- mRemoteInstanceId = remoteInstanceId;
- }
-
- public boolean isStarted() {
- return mStarted;
- }
-
- public void start(final Runnable completionCallback) {
- mIOExecutor.postOnSessionThread(0, new Runnable() {
- @Override
- public void run() {
- try {
- mBase.start(mClientFactory.newConfigClient().fetch());
- mStarted = true;
- } catch (IOException e) {
- Log.e(TAG, "Failed to start", e);
- } finally {
- completionCallback.run();
- }
- }
-
- });
- }
-
- public void dispose() {
- mBase.dispose();
- mIOExecutor.runSynchronously(new Runnable() {
- @Override
- public void run() {
- // All previously scheduled operations have completed.
- mClientFactory.close();
- }
- });
- mIOExecutor.dispose();
- }
-
- private class ServerProxy extends CommandSender {
- private final String mInstanceId;
-
- public ServerProxy(String instanceId) {
- mInstanceId = instanceId;
- }
-
- protected void send(Command command, Runnable completionCallback) {
- assert mIOExecutor.isCalledOnSessionThread();
-
- try {
- mClientFactory.newTestGCDClient(mOAuthToken).send(mRemoteInstanceId, command);
- } catch (IOException e) {
- Log.e(TAG, "Exception when sending a command", e);
- command.setFailure("IOException: " + e.getMessage());
- } finally {
- completionCallback.run();
- }
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698