OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_case.h" | 5 #include "ppapi/tests/test_case.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <sstream> | 10 #include <sstream> |
11 | 11 |
12 #include "ppapi/cpp/core.h" | 12 #include "ppapi/cpp/core.h" |
13 #include "ppapi/cpp/module.h" | 13 #include "ppapi/cpp/module.h" |
14 #include "ppapi/tests/pp_thread.h" | 14 #include "ppapi/tests/pp_thread.h" |
15 #include "ppapi/tests/test_utils.h" | 15 #include "ppapi/tests/test_utils.h" |
16 #include "ppapi/tests/testing_instance.h" | 16 #include "ppapi/tests/testing_instance.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 std::string StripPrefix(const std::string& test_name) { | 20 std::string StripPrefix(const std::string& test_name) { |
raymes
2015/05/14 01:53:47
Can we remove this function and just call the vers
raymes
2015/05/14 01:55:01
Ahh we can't do this because of DEPS.
tommycli
2015/05/14 17:44:23
Yes, I tried very hard. (see PS1 heh)
| |
21 const char* const prefixes[] = { | 21 if (test_name.find("DISABLED_") == 0) |
22 "FAILS_", "FLAKY_", "DISABLED_" }; | 22 return test_name.substr(strlen("DISABLED_")); |
23 for (size_t i = 0; i < sizeof(prefixes)/sizeof(prefixes[0]); ++i) | |
24 if (test_name.find(prefixes[i]) == 0) | |
25 return test_name.substr(strlen(prefixes[i])); | |
26 return test_name; | 23 return test_name; |
27 } | 24 } |
28 | 25 |
29 // Strip the TestCase name off and return the remainder (i.e., everything after | 26 // Strip the TestCase name off and return the remainder (i.e., everything after |
30 // '_'). If there is no '_', assume only the TestCase was provided, and return | 27 // '_'). If there is no '_', assume only the TestCase was provided, and return |
31 // an empty string. | 28 // an empty string. |
32 // For example: | 29 // For example: |
33 // StripTestCase("TestCase_TestName"); | 30 // StripTestCase("TestCase_TestName"); |
34 // returns | 31 // returns |
35 // "TestName" | 32 // "TestName" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 void (*thread_func)(void*), | 248 void (*thread_func)(void*), |
252 void* thread_param, | 249 void* thread_param, |
253 const PPB_Testing_Private* testing_interface) { | 250 const PPB_Testing_Private* testing_interface) { |
254 PP_Thread thread; | 251 PP_Thread thread; |
255 PP_CreateThread(&thread, thread_func, thread_param); | 252 PP_CreateThread(&thread, thread_func, thread_param); |
256 // Run a message loop so pepper calls can be dispatched. The background | 253 // Run a message loop so pepper calls can be dispatched. The background |
257 // thread will set result_ and make us Quit when it's done. | 254 // thread will set result_ and make us Quit when it's done. |
258 testing_interface->RunMessageLoop(instance_->pp_instance()); | 255 testing_interface->RunMessageLoop(instance_->pp_instance()); |
259 PP_JoinThread(thread); | 256 PP_JoinThread(thread); |
260 } | 257 } |
OLD | NEW |