| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/devtools/device/adb/mock_adb_server.h" | 5 #include "chrome/browser/devtools/device/adb/mock_adb_server.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 kSerialOnline, | 426 kSerialOnline, |
| 427 kSerialOffline)); | 427 kSerialOffline)); |
| 428 } else if (base::StartsWith(command, kHostTransportPrefix, | 428 } else if (base::StartsWith(command, kHostTransportPrefix, |
| 429 base::CompareCase::SENSITIVE)) { | 429 base::CompareCase::SENSITIVE)) { |
| 430 serial_ = command.substr(sizeof(kHostTransportPrefix) - 1); | 430 serial_ = command.substr(sizeof(kHostTransportPrefix) - 1); |
| 431 SendSuccess(std::string()); | 431 SendSuccess(std::string()); |
| 432 } else if (serial_ != kSerialOnline) { | 432 } else if (serial_ != kSerialOnline) { |
| 433 Send("FAIL", "device offline (x)"); | 433 Send("FAIL", "device offline (x)"); |
| 434 } else { | 434 } else { |
| 435 mock_connection_ = | 435 mock_connection_ = |
| 436 base::WrapUnique(new MockAndroidConnection(this, serial_, command)); | 436 base::MakeUnique<MockAndroidConnection>(this, serial_, command); |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 | 439 |
| 440 void SendSuccess(const std::string& response) override { | 440 void SendSuccess(const std::string& response) override { |
| 441 Send("OKAY", response); | 441 Send("OKAY", response); |
| 442 } | 442 } |
| 443 | 443 |
| 444 void SendRaw(const std::string& data) override { | 444 void SendRaw(const std::string& data) override { |
| 445 callback_.Run(data); | 445 callback_.Run(data); |
| 446 } | 446 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 content::RunMessageLoop(); | 613 content::RunMessageLoop(); |
| 614 } | 614 } |
| 615 | 615 |
| 616 void StopMockAdbServer() { | 616 void StopMockAdbServer() { |
| 617 BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, | 617 BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, |
| 618 base::Bind(&StopMockAdbServerOnIOThread), | 618 base::Bind(&StopMockAdbServerOnIOThread), |
| 619 base::MessageLoop::QuitWhenIdleClosure()); | 619 base::MessageLoop::QuitWhenIdleClosure()); |
| 620 content::RunMessageLoop(); | 620 content::RunMessageLoop(); |
| 621 } | 621 } |
| 622 | 622 |
| OLD | NEW |