| 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_utils.h" | 5 #include "ppapi/tests/test_utils.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #if defined(_MSC_VER) | 9 #if defined(_MSC_VER) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 bool GetLocalHostPort(PP_Instance instance, std::string* host, uint16_t* port) { | 44 bool GetLocalHostPort(PP_Instance instance, std::string* host, uint16_t* port) { |
| 45 if (!host || !port) | 45 if (!host || !port) |
| 46 return false; | 46 return false; |
| 47 | 47 |
| 48 const PPB_Testing_Dev* testing = GetTestingInterface(); | 48 const PPB_Testing_Dev* testing = GetTestingInterface(); |
| 49 if (!testing) | 49 if (!testing) |
| 50 return false; | 50 return false; |
| 51 | 51 |
| 52 PP_URLComponents_Dev components; | 52 PP_URLComponents_Dev components; |
| 53 pp::Var pp_url(pp::Var::PassRef(), | 53 pp::Var pp_url(pp::PASS_REF, |
| 54 testing->GetDocumentURL(instance, &components)); | 54 testing->GetDocumentURL(instance, &components)); |
| 55 if (!pp_url.is_string()) | 55 if (!pp_url.is_string()) |
| 56 return false; | 56 return false; |
| 57 std::string url = pp_url.AsString(); | 57 std::string url = pp_url.AsString(); |
| 58 | 58 |
| 59 if (components.host.len < 0) | 59 if (components.host.len < 0) |
| 60 return false; | 60 return false; |
| 61 host->assign(url.substr(components.host.begin, components.host.len)); | 61 host->assign(url.substr(components.host.begin, components.host.len)); |
| 62 | 62 |
| 63 if (components.port.len <= 0) | 63 if (components.port.len <= 0) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 TestCompletionCallback* callback = | 112 TestCompletionCallback* callback = |
| 113 static_cast<TestCompletionCallback*>(user_data); | 113 static_cast<TestCompletionCallback*>(user_data); |
| 114 callback->result_ = result; | 114 callback->result_ = result; |
| 115 callback->have_result_ = true; | 115 callback->have_result_ = true; |
| 116 callback->run_count_++; | 116 callback->run_count_++; |
| 117 if (callback->post_quit_task_) { | 117 if (callback->post_quit_task_) { |
| 118 callback->post_quit_task_ = false; | 118 callback->post_quit_task_ = false; |
| 119 GetTestingInterface()->QuitMessageLoop(callback->instance_); | 119 GetTestingInterface()->QuitMessageLoop(callback->instance_); |
| 120 } | 120 } |
| 121 } | 121 } |
| OLD | NEW |