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> |
| 8 #include <stdint.h> |
| 9 |
7 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/macros.h" |
8 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
9 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
12 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
13 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
14 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
15 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
16 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/test/browser_test.h" | 21 #include "content/public/test/browser_test.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 " \"id\": \"44681551-ADFD-2411-076B-3AB14C1C60E2\",\n" | 168 " \"id\": \"44681551-ADFD-2411-076B-3AB14C1C60E2\",\n" |
165 " \"thumbnailUrl\": \"/thumb/44681551-ADFD-2411-076B-3AB14C1C60E2\",\n" | 169 " \"thumbnailUrl\": \"/thumb/44681551-ADFD-2411-076B-3AB14C1C60E2\",\n" |
166 " \"title\": \"More Activity\",\n" | 170 " \"title\": \"More Activity\",\n" |
167 " \"type\": \"page\",\n" | 171 " \"type\": \"page\",\n" |
168 " \"url\": \"about:blank\",\n" | 172 " \"url\": \"about:blank\",\n" |
169 " \"webSocketDebuggerUrl\": \"ws:///devtools/page/" | 173 " \"webSocketDebuggerUrl\": \"ws:///devtools/page/" |
170 "44681551-ADFD-2411-076B-3AB14C1C60E2\"\n" | 174 "44681551-ADFD-2411-076B-3AB14C1C60E2\"\n" |
171 "}]"; | 175 "}]"; |
172 | 176 |
173 static const int kBufferSize = 16*1024; | 177 static const int kBufferSize = 16*1024; |
174 static const uint16 kAdbPort = 5037; | 178 static const uint16_t kAdbPort = 5037; |
175 | 179 |
176 static const int kAdbMessageHeaderSize = 4; | 180 static const int kAdbMessageHeaderSize = 4; |
177 | 181 |
178 class SimpleHttpServer : base::NonThreadSafe { | 182 class SimpleHttpServer : base::NonThreadSafe { |
179 public: | 183 public: |
180 class Parser { | 184 class Parser { |
181 public: | 185 public: |
182 virtual int Consume(const char* data, int size) = 0; | 186 virtual int Consume(const char* data, int size) = 0; |
183 virtual ~Parser() {} | 187 virtual ~Parser() {} |
184 }; | 188 }; |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 content::RunMessageLoop(); | 611 content::RunMessageLoop(); |
608 } | 612 } |
609 | 613 |
610 void StopMockAdbServer() { | 614 void StopMockAdbServer() { |
611 BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, | 615 BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, |
612 base::Bind(&StopMockAdbServerOnIOThread), | 616 base::Bind(&StopMockAdbServerOnIOThread), |
613 base::MessageLoop::QuitWhenIdleClosure()); | 617 base::MessageLoop::QuitWhenIdleClosure()); |
614 content::RunMessageLoop(); | 618 content::RunMessageLoop(); |
615 } | 619 } |
616 | 620 |
OLD | NEW |