| 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/testing_instance.h" | 5 #include "ppapi/tests/testing_instance.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 TestingInstance::TestingInstance(PP_Instance instance) | 25 TestingInstance::TestingInstance(PP_Instance instance) |
| 26 #if (defined __native_client__) | 26 #if (defined __native_client__) |
| 27 : pp::Instance(instance), | 27 : pp::Instance(instance), |
| 28 #else | 28 #else |
| 29 : pp::InstancePrivate(instance), | 29 : pp::InstancePrivate(instance), |
| 30 #endif | 30 #endif |
| 31 current_case_(NULL), | 31 current_case_(NULL), |
| 32 executed_tests_(false), | 32 executed_tests_(false), |
| 33 nacl_mode_(false), | 33 nacl_mode_(false), |
| 34 ssl_server_port_(-1), | 34 ssl_server_port_(-1), |
| 35 websocket_port_(-1) { | 35 websocket_port_(-1), |
| 36 remove_plugin_(true) { |
| 36 callback_factory_.Initialize(this); | 37 callback_factory_.Initialize(this); |
| 37 } | 38 } |
| 38 | 39 |
| 39 TestingInstance::~TestingInstance() { | 40 TestingInstance::~TestingInstance() { |
| 40 if (current_case_) | 41 if (current_case_) |
| 41 delete current_case_; | 42 delete current_case_; |
| 42 } | 43 } |
| 43 | 44 |
| 44 bool TestingInstance::Init(uint32_t argc, | 45 bool TestingInstance::Init(uint32_t argc, |
| 45 const char* argn[], | 46 const char* argn[], |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } else { | 162 } else { |
| 162 current_case_->RunTests(test_filter_); | 163 current_case_->RunTests(test_filter_); |
| 163 // Automated PyAuto tests rely on finding the exact strings below. | 164 // Automated PyAuto tests rely on finding the exact strings below. |
| 164 LogHTML(errors_.empty() ? | 165 LogHTML(errors_.empty() ? |
| 165 "<span class=\"pass\">[SHUTDOWN]</span> All tests passed." : | 166 "<span class=\"pass\">[SHUTDOWN]</span> All tests passed." : |
| 166 "<span class=\"fail\">[SHUTDOWN]</span> Some tests failed."); | 167 "<span class=\"fail\">[SHUTDOWN]</span> Some tests failed."); |
| 167 } | 168 } |
| 168 | 169 |
| 169 // Declare we're done by setting a cookie to either "PASS" or the errors. | 170 // Declare we're done by setting a cookie to either "PASS" or the errors. |
| 170 ReportProgress(errors_.empty() ? "PASS" : errors_); | 171 ReportProgress(errors_.empty() ? "PASS" : errors_); |
| 171 SendTestCommand("DidExecuteTests"); | 172 if (remove_plugin_) |
| 173 SendTestCommand("DidExecuteTests"); |
| 172 // Note, DidExecuteTests unloads the plugin. We can't really do anthing after | 174 // Note, DidExecuteTests unloads the plugin. We can't really do anthing after |
| 173 // this point. | 175 // this point. |
| 174 } | 176 } |
| 175 | 177 |
| 176 TestCase* TestingInstance::CaseForTestName(const std::string& name) { | 178 TestCase* TestingInstance::CaseForTestName(const std::string& name) { |
| 177 std::string case_name = name.substr(0, name.find_first_of('_')); | 179 std::string case_name = name.substr(0, name.find_first_of('_')); |
| 178 TestCaseFactory* iter = TestCaseFactory::head_; | 180 TestCaseFactory* iter = TestCaseFactory::head_; |
| 179 while (iter != NULL) { | 181 while (iter != NULL) { |
| 180 if (case_name == iter->name_) | 182 if (case_name == iter->name_) |
| 181 return iter->method_(this); | 183 return iter->method_(this); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 266 } |
| 265 }; | 267 }; |
| 266 | 268 |
| 267 namespace pp { | 269 namespace pp { |
| 268 | 270 |
| 269 Module* CreateModule() { | 271 Module* CreateModule() { |
| 270 return new ::Module(); | 272 return new ::Module(); |
| 271 } | 273 } |
| 272 | 274 |
| 273 } // namespace pp | 275 } // namespace pp |
| OLD | NEW |