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 #if defined(_MSC_VER) | 8 #if defined(_MSC_VER) |
9 #include <windows.h> | 9 #include <windows.h> |
10 #else | 10 #else |
11 #include <unistd.h> | 11 #include <unistd.h> |
12 #endif | 12 #endif |
13 | 13 |
14 #include "ppapi/c/pp_errors.h" | 14 #include "ppapi/c/pp_errors.h" |
15 #include "ppapi/cpp/module.h" | 15 #include "ppapi/cpp/module.h" |
16 | 16 |
17 const int kActionTimeoutMs = 10000; | 17 const int kActionTimeoutMs = 10000; |
18 | 18 |
19 const PPB_Testing_Dev* GetTestingInterface() { | 19 const PPB_Testing_Dev* GetTestingInterface() { |
20 static const PPB_Testing_Dev* g_testing_interface = | 20 static const PPB_Testing_Dev* g_testing_interface = |
21 reinterpret_cast<PPB_Testing_Dev const*>( | 21 static_cast<const PPB_Testing_Dev*>( |
22 pp::Module::Get()->GetBrowserInterface(PPB_TESTING_DEV_INTERFACE)); | 22 pp::Module::Get()->GetBrowserInterface(PPB_TESTING_DEV_INTERFACE)); |
23 return g_testing_interface; | 23 return g_testing_interface; |
24 } | 24 } |
25 | 25 |
26 std::string ReportError(const char* method, int32_t error) { | 26 std::string ReportError(const char* method, int32_t error) { |
27 char error_as_string[12]; | 27 char error_as_string[12]; |
28 sprintf(error_as_string, "%d", static_cast<int>(error)); | 28 sprintf(error_as_string, "%d", static_cast<int>(error)); |
29 std::string result = method + std::string(" failed with error: ") + | 29 std::string result = method + std::string(" failed with error: ") + |
30 error_as_string; | 30 error_as_string; |
31 return result; | 31 return result; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 TestCompletionCallback* callback = | 80 TestCompletionCallback* callback = |
81 static_cast<TestCompletionCallback*>(user_data); | 81 static_cast<TestCompletionCallback*>(user_data); |
82 callback->result_ = result; | 82 callback->result_ = result; |
83 callback->have_result_ = true; | 83 callback->have_result_ = true; |
84 callback->run_count_++; | 84 callback->run_count_++; |
85 if (callback->post_quit_task_) { | 85 if (callback->post_quit_task_) { |
86 callback->post_quit_task_ = false; | 86 callback->post_quit_task_ = false; |
87 GetTestingInterface()->QuitMessageLoop(callback->instance_); | 87 GetTestingInterface()->QuitMessageLoop(callback->instance_); |
88 } | 88 } |
89 } | 89 } |
OLD | NEW |