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

Unified Diff: components/devtools_bridge/test/android/javatests/src/org/chromium/components/devtools_bridge/PacketDecoder.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/PacketDecoder.java
diff --git a/components/devtools_bridge/test/android/javatests/src/org/chromium/components/devtools_bridge/PacketDecoder.java b/components/devtools_bridge/test/android/javatests/src/org/chromium/components/devtools_bridge/PacketDecoder.java
deleted file mode 100644
index d8e0dff56d4524064ea3734670d824991d607567..0000000000000000000000000000000000000000
--- a/components/devtools_bridge/test/android/javatests/src/org/chromium/components/devtools_bridge/PacketDecoder.java
+++ /dev/null
@@ -1,67 +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 java.nio.ByteBuffer;
-
-/**
- * Decodes data packets of SocketTunnelClient and SocketTunnelServer for tests.
- */
-public final class PacketDecoder extends SocketTunnelBase.PacketDecoderBase {
- private boolean mControlPacket = false;
- private boolean mDataPacket;
- private int mOpCode;
- private int mConnectionId;
- private byte[] mData;
-
- protected void onReceivedDataPacket(int connectionId, byte[] data) {
- mDataPacket = true;
- mConnectionId = connectionId;
- mData = data;
- }
-
- @Override
- protected void onReceivedControlPacket(int connectionId, byte opCode) {
- mControlPacket = true;
- mOpCode = opCode;
- mConnectionId = connectionId;
- }
-
- public static PacketDecoder tryDecode(ByteBuffer packet) throws SocketTunnelBase.ProtocolError {
- PacketDecoder decoder = new PacketDecoder();
- decoder.decodePacket(packet);
- return decoder;
- }
-
- public static PacketDecoder decode(ByteBuffer packet) {
- try {
- return tryDecode(packet);
- } catch (SocketTunnelBase.ProtocolError e) {
- throw new RuntimeException(e);
- }
- }
-
- public boolean isControlPacket() {
- return mControlPacket;
- }
-
- public boolean isDataPacket() {
- return mDataPacket;
- }
-
- public int opCode() {
- assert isControlPacket();
- return mOpCode;
- }
-
- public int connectionId() {
- return mConnectionId;
- }
-
- public byte[] data() {
- assert isDataPacket();
- return mData.clone();
- }
-}

Powered by Google App Engine
This is Rietveld 408576698