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.
21 void StartMockAdbServer(FlushMode flush_mode
);
22 void StopMockAdbServer();
24 // Part of mock server independent of transport.
25 class MockAndroidConnection
{
29 virtual void SendSuccess(const std::string
& message
) {}
30 virtual void SendRaw(const std::string
& data
) {}
31 virtual void Close() {}
32 virtual ~Delegate() {}
34 using Callback
= base::Callback
<void(const std::string
&)>;
35 MockAndroidConnection(Delegate
* delegate
,
36 const std::string
& serial
,
37 const std::string
& command
);
38 virtual ~MockAndroidConnection();
40 void Receive(const std::string
& data
);
43 void ProcessCommand(const std::string
& command
);
44 void SendHTTPResponse(const std::string
& body
);
48 std::string socket_name_
;
52 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ADB_MOCK_ADB_SERVER_H_