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 "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 | 594 |
595 void MockAndroidConnection::SendHTTPResponse(const std::string& body) { | 595 void MockAndroidConnection::SendHTTPResponse(const std::string& body) { |
596 std::string response_data(base::StringPrintf(kHttpResponse, | 596 std::string response_data(base::StringPrintf(kHttpResponse, |
597 static_cast<int>(body.size()), | 597 static_cast<int>(body.size()), |
598 body.c_str())); | 598 body.c_str())); |
599 delegate_->SendRaw(response_data); | 599 delegate_->SendRaw(response_data); |
600 } | 600 } |
601 | 601 |
602 void StartMockAdbServer(FlushMode flush_mode) { | 602 void StartMockAdbServer(FlushMode flush_mode) { |
603 BrowserThread::PostTaskAndReply( | 603 BrowserThread::PostTaskAndReply( |
604 BrowserThread::IO, | 604 BrowserThread::IO, FROM_HERE, |
605 FROM_HERE, | |
606 base::Bind(&StartMockAdbServerOnIOThread, flush_mode), | 605 base::Bind(&StartMockAdbServerOnIOThread, flush_mode), |
607 base::MessageLoop::QuitClosure()); | 606 base::MessageLoop::QuitWhenIdleClosure()); |
608 content::RunMessageLoop(); | 607 content::RunMessageLoop(); |
609 } | 608 } |
610 | 609 |
611 void StopMockAdbServer() { | 610 void StopMockAdbServer() { |
612 BrowserThread::PostTaskAndReply( | 611 BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, |
613 BrowserThread::IO, | 612 base::Bind(&StopMockAdbServerOnIOThread), |
614 FROM_HERE, | 613 base::MessageLoop::QuitWhenIdleClosure()); |
615 base::Bind(&StopMockAdbServerOnIOThread), | |
616 base::MessageLoop::QuitClosure()); | |
617 content::RunMessageLoop(); | 614 content::RunMessageLoop(); |
618 } | 615 } |
619 | 616 |
OLD | NEW |