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 #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/cpp/completion_callback.h" | 10 #include "ppapi/cpp/completion_callback.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 virtual void HandleMessage(const pp::Var& message_data); | 80 virtual void HandleMessage(const pp::Var& message_data); |
81 | 81 |
82 const std::string& protocol() { | 82 const std::string& protocol() { |
83 return protocol_; | 83 return protocol_; |
84 } | 84 } |
85 | 85 |
86 private: | 86 private: |
87 void ExecuteTests(int32_t unused); | 87 void ExecuteTests(int32_t unused); |
88 | 88 |
89 // Creates a new TestCase for the give test name, or NULL if there is no such | 89 // Creates a new TestCase for the give test name, or NULL if there is no such |
90 // test. Ownership is passed to the caller. | 90 // test. Ownership is passed to the caller. The given string is split by '_'. |
91 TestCase* CaseForTestName(const char* name); | 91 // The test case name is the first part. |
| 92 TestCase* CaseForTestName(const std::string& name); |
| 93 // Returns the filter (second part) of the given string. |
| 94 std::string FilterForTestName(const std::string& name); |
92 | 95 |
93 // Appends a list of available tests to the console in the document. | 96 // Appends a list of available tests to the console in the document. |
94 void LogAvailableTests(); | 97 void LogAvailableTests(); |
95 | 98 |
96 // Appends the given error test to the console in the document. | 99 // Appends the given error test to the console in the document. |
97 void LogError(const std::string& text); | 100 void LogError(const std::string& text); |
98 | 101 |
99 // Appends the given HTML string to the console in the document. | 102 // Appends the given HTML string to the console in the document. |
100 void LogHTML(const std::string& html); | 103 void LogHTML(const std::string& html); |
101 | 104 |
102 void ReportProgress(const std::string& progress_value); | 105 void ReportProgress(const std::string& progress_value); |
103 | 106 |
104 // Sets the given cookie in the current document. | 107 // Sets the given cookie in the current document. |
105 void SetCookie(const std::string& name, const std::string& value); | 108 void SetCookie(const std::string& name, const std::string& value); |
106 | 109 |
107 pp::CompletionCallbackFactory<TestingInstance> callback_factory_; | 110 pp::CompletionCallbackFactory<TestingInstance> callback_factory_; |
108 | 111 |
109 // Owning pointer to the current test case. Valid after Init has been called. | 112 // Owning pointer to the current test case. Valid after Init has been called. |
110 TestCase* current_case_; | 113 TestCase* current_case_; |
111 | 114 |
| 115 // A filter to use when running tests. This is passed to 'RunTests', which |
| 116 // runs only tests whose name contains test_filter_ as a substring. |
| 117 std::string test_filter_; |
| 118 |
112 // The current step we're on starting at 0. This is incremented every time we | 119 // The current step we're on starting at 0. This is incremented every time we |
113 // report progress via a cookie. See comment above the class. | 120 // report progress via a cookie. See comment above the class. |
114 int progress_cookie_number_; | 121 int progress_cookie_number_; |
115 | 122 |
116 // Set once the tests are run so we know not to re-run when the view is sized. | 123 // Set once the tests are run so we know not to re-run when the view is sized. |
117 bool executed_tests_; | 124 bool executed_tests_; |
118 | 125 |
119 // Collects all errors to send the the browser. Empty indicates no error yet. | 126 // Collects all errors to send the the browser. Empty indicates no error yet. |
120 std::string errors_; | 127 std::string errors_; |
121 | 128 |
122 // True if running in Native Client. | 129 // True if running in Native Client. |
123 bool nacl_mode_; | 130 bool nacl_mode_; |
124 | 131 |
125 // String representing the protocol. Used for detecting whether we're running | 132 // String representing the protocol. Used for detecting whether we're running |
126 // with http. | 133 // with http. |
127 std::string protocol_; | 134 std::string protocol_; |
128 }; | 135 }; |
129 | 136 |
130 #endif // PPAPI_TESTS_TESTING_INSTANCE_H_ | 137 #endif // PPAPI_TESTS_TESTING_INSTANCE_H_ |
OLD | NEW |