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.
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_ADB_MOCK_ADB_SERVER_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_ADB_MOCK_ADB_SERVER_H_
10 #include "base/callback.h"
12 // Single instance mock ADB server for use in browser tests. Runs on IO thread.
14 // These methods can be called from any thread.
15 void StartMockAdbServer();
16 void StopMockAdbServer();
18 // Part of mock server independent of transport.
19 class MockAndroidConnection
{
23 virtual void SendSuccess(const std::string
& message
) {}
24 virtual void SendRaw(const std::string
& data
) {}
25 virtual void Close() {}
26 virtual ~Delegate() {}
28 using Callback
= base::Callback
<void(const std::string
&)>;
29 MockAndroidConnection(Delegate
* delegate
,
30 const std::string
& serial
,
31 const std::string
& command
);
32 virtual ~MockAndroidConnection();
34 void Receive(const std::string
& data
);
37 void ProcessCommand(const std::string
& command
);
38 void SendHTTPResponse(const std::string
& body
);
42 std::string socket_name_
;
46 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ADB_MOCK_ADB_SERVER_H_