OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/tests/test_tcp_socket_private.h" | 5 #include "ppapi/tests/test_tcp_socket_private.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "ppapi/c/dev/ppb_url_util_dev.h" | 9 #include "ppapi/c/dev/ppb_url_util_dev.h" |
10 #include "ppapi/cpp/dev/url_util_dev.h" | 10 #include "ppapi/cpp/dev/url_util_dev.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 return false; | 42 return false; |
43 if (!testing->IsOutOfProcess()) | 43 if (!testing->IsOutOfProcess()) |
44 return false; | 44 return false; |
45 | 45 |
46 // We need something to connect to, so we connect to the HTTP server whence we | 46 // We need something to connect to, so we connect to the HTTP server whence we |
47 // came. Grab the host and port. | 47 // came. Grab the host and port. |
48 if (!EnsureRunningOverHTTP()) | 48 if (!EnsureRunningOverHTTP()) |
49 return false; | 49 return false; |
50 | 50 |
51 PP_URLComponents_Dev components; | 51 PP_URLComponents_Dev components; |
52 pp::Var pp_url = pp::URLUtil_Dev::Get()->GetDocumentURL(*instance_, | 52 pp::Var pp_url = pp::URLUtil_Dev::Get()->GetDocumentURL(instance_, |
53 &components); | 53 &components); |
54 if (!pp_url.is_string()) | 54 if (!pp_url.is_string()) |
55 return false; | 55 return false; |
56 std::string url = pp_url.AsString(); | 56 std::string url = pp_url.AsString(); |
57 | 57 |
58 // Double-check that we're running on HTTP. | 58 // Double-check that we're running on HTTP. |
59 if (components.scheme.len < 0) | 59 if (components.scheme.len < 0) |
60 return false; | 60 return false; |
61 if (url.substr(components.scheme.begin, components.scheme.len) != "http") | 61 if (url.substr(components.scheme.begin, components.scheme.len) != "http") |
62 return false; | 62 return false; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 if (rv < 0) | 208 if (rv < 0) |
209 return rv; | 209 return rv; |
210 if (rv == 0) | 210 if (rv == 0) |
211 return PP_ERROR_FAILED; | 211 return PP_ERROR_FAILED; |
212 written += rv; | 212 written += rv; |
213 } | 213 } |
214 if (written != s.size()) | 214 if (written != s.size()) |
215 return PP_ERROR_FAILED; | 215 return PP_ERROR_FAILED; |
216 return PP_OK; | 216 return PP_OK; |
217 } | 217 } |
OLD | NEW |