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 <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // TODO(dmichael): It might be nice to be able to PP_DCHECK against the | 45 // TODO(dmichael): It might be nice to be able to PP_DCHECK against the |
46 // TestCase class name, but we'd have to plumb that name to TestCase somehow. | 46 // TestCase class name, but we'd have to plumb that name to TestCase somehow. |
47 return std::string(); | 47 return std::string(); |
48 } | 48 } |
49 | 49 |
50 // Parse |test_filter|, which is a comma-delimited list of (possibly prefixed) | 50 // Parse |test_filter|, which is a comma-delimited list of (possibly prefixed) |
51 // test names and insert the un-prefixed names into |remaining_tests|, with | 51 // test names and insert the un-prefixed names into |remaining_tests|, with |
52 // the bool indicating whether the test should be run. | 52 // the bool indicating whether the test should be run. |
53 void ParseTestFilter(const std::string& test_filter, | 53 void ParseTestFilter(const std::string& test_filter, |
54 std::map<std::string, bool>* remaining_tests) { | 54 std::map<std::string, bool>* remaining_tests) { |
55 // We can't use base/string_util.h::Tokenize in ppapi, so we have to do it | 55 // We can't use base/strings/string_util.h::Tokenize in ppapi, so we have to |
56 // ourselves. | 56 // do it ourselves. |
57 std::istringstream filter_stream(test_filter); | 57 std::istringstream filter_stream(test_filter); |
58 std::string current_test; | 58 std::string current_test; |
59 while (std::getline(filter_stream, current_test, ',')) { | 59 while (std::getline(filter_stream, current_test, ',')) { |
60 // |current_test| might include a prefix, like DISABLED_Foo_TestBar, so we | 60 // |current_test| might include a prefix, like DISABLED_Foo_TestBar, so we |
61 // we strip it off if there is one. | 61 // we strip it off if there is one. |
62 std::string stripped_test_name(StripPrefix(current_test)); | 62 std::string stripped_test_name(StripPrefix(current_test)); |
63 // Strip off the test case and use the test name as a key, because the test | 63 // Strip off the test case and use the test name as a key, because the test |
64 // name ShouldRunTest wants to use to look up the test doesn't have the | 64 // name ShouldRunTest wants to use to look up the test doesn't have the |
65 // TestCase name. | 65 // TestCase name. |
66 std::string test_name_without_case(StripTestCase(stripped_test_name)); | 66 std::string test_name_without_case(StripTestCase(stripped_test_name)); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 void TestCase::RunOnThreadInternal(void (*thread_func)(void*), | 257 void TestCase::RunOnThreadInternal(void (*thread_func)(void*), |
258 void* thread_param, | 258 void* thread_param, |
259 const PPB_Testing_Dev* testing_interface) { | 259 const PPB_Testing_Dev* testing_interface) { |
260 PP_ThreadType thread; | 260 PP_ThreadType thread; |
261 PP_CreateThread(&thread, thread_func, thread_param); | 261 PP_CreateThread(&thread, thread_func, thread_param); |
262 // Run a message loop so pepper calls can be dispatched. The background | 262 // Run a message loop so pepper calls can be dispatched. The background |
263 // thread will set result_ and make us Quit when it's done. | 263 // thread will set result_ and make us Quit when it's done. |
264 testing_interface->RunMessageLoop(instance_->pp_instance()); | 264 testing_interface->RunMessageLoop(instance_->pp_instance()); |
265 PP_JoinThread(thread); | 265 PP_JoinThread(thread); |
266 } | 266 } |
OLD | NEW |