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 #ifndef PPAPI_TESTS_TESTING_INSTANCE_H_ | 5 #ifndef PPAPI_TESTS_TESTING_INSTANCE_H_ |
6 #define PPAPI_TESTS_TESTING_INSTANCE_H_ | 6 #define PPAPI_TESTS_TESTING_INSTANCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/utility/completion_callback_factory.h" | 10 #include "ppapi/utility/completion_callback_factory.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // return "Something horrible happened"; | 80 // return "Something horrible happened"; |
81 // return ""; | 81 // return ""; |
82 // } | 82 // } |
83 // | 83 // |
84 // NOTE: It's important to get the start time in the previous line, rather | 84 // NOTE: It's important to get the start time in the previous line, rather |
85 // than calling GetTimeTicks in the LogTestLine. There's no guarantee | 85 // than calling GetTimeTicks in the LogTestLine. There's no guarantee |
86 // that GetTimeTicks will be evaluated before FooTest(). | 86 // that GetTimeTicks will be evaluated before FooTest(). |
87 void LogTest(const std::string& test_name, | 87 void LogTest(const std::string& test_name, |
88 const std::string& error_message, | 88 const std::string& error_message, |
89 PP_TimeTicks start_time); | 89 PP_TimeTicks start_time); |
| 90 const std::string& current_test_name() { return current_test_name_; } |
90 | 91 |
91 // Appends an error message to the log. | 92 // Appends an error message to the log. |
92 void AppendError(const std::string& message); | 93 void AppendError(const std::string& message); |
93 | 94 |
94 // Passes the message_data through to the HandleMessage method on the | 95 // Passes the message_data through to the HandleMessage method on the |
95 // TestClass object that's associated with this instance. | 96 // TestClass object that's associated with this instance. |
96 virtual void HandleMessage(const pp::Var& message_data); | 97 virtual void HandleMessage(const pp::Var& message_data); |
97 | 98 |
98 const std::string& protocol() { | 99 const std::string& protocol() { |
99 return protocol_; | 100 return protocol_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void LogError(const std::string& text); | 144 void LogError(const std::string& text); |
144 | 145 |
145 // Appends the given HTML string to the console in the document. | 146 // Appends the given HTML string to the console in the document. |
146 void LogHTML(const std::string& html); | 147 void LogHTML(const std::string& html); |
147 | 148 |
148 pp::CompletionCallbackFactory<TestingInstance> callback_factory_; | 149 pp::CompletionCallbackFactory<TestingInstance> callback_factory_; |
149 | 150 |
150 // Owning pointer to the current test case. Valid after Init has been called. | 151 // Owning pointer to the current test case. Valid after Init has been called. |
151 TestCase* current_case_; | 152 TestCase* current_case_; |
152 | 153 |
| 154 std::string current_test_name_; |
| 155 |
153 // A filter to use when running tests. This is passed to 'RunTests', which | 156 // A filter to use when running tests. This is passed to 'RunTests', which |
154 // runs only tests whose name contains test_filter_ as a substring. | 157 // runs only tests whose name contains test_filter_ as a substring. |
155 std::string test_filter_; | 158 std::string test_filter_; |
156 | 159 |
157 // Set once the tests are run so we know not to re-run when the view is sized. | 160 // Set once the tests are run so we know not to re-run when the view is sized. |
158 bool executed_tests_; | 161 bool executed_tests_; |
159 | 162 |
160 // The number of tests executed so far. | 163 // The number of tests executed so far. |
161 int32_t number_tests_executed_; | 164 int32_t number_tests_executed_; |
162 | 165 |
(...skipping 16 matching lines...) Expand all Loading... |
179 // WebSocket port. | 182 // WebSocket port. |
180 int websocket_port_; | 183 int websocket_port_; |
181 | 184 |
182 // At the end of each set of tests, the plugin is removed from the web-page. | 185 // At the end of each set of tests, the plugin is removed from the web-page. |
183 // However, for some tests, it is desirable to not remove the plguin from the | 186 // However, for some tests, it is desirable to not remove the plguin from the |
184 // page. | 187 // page. |
185 bool remove_plugin_; | 188 bool remove_plugin_; |
186 }; | 189 }; |
187 | 190 |
188 #endif // PPAPI_TESTS_TESTING_INSTANCE_H_ | 191 #endif // PPAPI_TESTS_TESTING_INSTANCE_H_ |
OLD | NEW |