OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_url_loader.h" | 5 #include "ppapi/tests/test_url_loader.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "ppapi/c/dev/ppb_file_io_dev.h" | 10 #include "ppapi/c/dev/ppb_file_io_dev.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 static void Handler(void* user_data, int32_t result) { | 48 static void Handler(void* user_data, int32_t result) { |
49 static_cast<TestCompletionCallback*>(user_data)->result_ = result; | 49 static_cast<TestCompletionCallback*>(user_data)->result_ = result; |
50 g_testing_interface->QuitMessageLoop(); | 50 g_testing_interface->QuitMessageLoop(); |
51 } | 51 } |
52 | 52 |
53 int32_t result_; | 53 int32_t result_; |
54 }; | 54 }; |
55 | 55 |
56 std::string ReportError(const char* method, int32_t error) { | 56 std::string ReportError(const char* method, int32_t error) { |
57 char error_as_string[12]; | 57 char error_as_string[12]; |
58 sprintf(error_as_string, "%d", error); | 58 sprintf(error_as_string, "%d", static_cast<int>(error)); |
59 return method + std::string(" failed with error: ") + error_as_string; | 59 return method + std::string(" failed with error: ") + error_as_string; |
60 } | 60 } |
61 | 61 |
62 } // namespace | 62 } // namespace |
63 | 63 |
64 bool TestURLLoader::Init() { | 64 bool TestURLLoader::Init() { |
65 g_testing_interface = reinterpret_cast<PPB_Testing_Dev const*>( | 65 g_testing_interface = reinterpret_cast<PPB_Testing_Dev const*>( |
66 pp::Module::Get()->GetBrowserInterface(PPB_TESTING_DEV_INTERFACE)); | 66 pp::Module::Get()->GetBrowserInterface(PPB_TESTING_DEV_INTERFACE)); |
67 if (!g_testing_interface) { | 67 if (!g_testing_interface) { |
68 // Give a more helpful error message for the testing interface being gone | 68 // Give a more helpful error message for the testing interface being gone |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 return "URLLoader::Open() failed to block a cross-origin request."; | 306 return "URLLoader::Open() failed to block a cross-origin request."; |
307 } else { | 307 } else { |
308 return ReportError("URLLoader::Open()", rv); | 308 return ReportError("URLLoader::Open()", rv); |
309 } | 309 } |
310 } | 310 } |
311 | 311 |
312 return ""; | 312 return ""; |
313 } | 313 } |
314 | 314 |
315 // TODO(darin): Add a test for GrantUniversalAccess. | 315 // TODO(darin): Add a test for GrantUniversalAccess. |
OLD | NEW |