| 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 15 matching lines...) Expand all Loading... |
| 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 number_tests_executed_(0), | 33 number_tests_executed_(0), |
| 34 nacl_mode_(false), | 34 nacl_mode_(false), |
| 35 ssl_server_port_(-1), | 35 ssl_server_port_(-1), |
| 36 websocket_port_(-1) { | 36 websocket_port_(-1), |
| 37 remove_plugin_(true) { |
| 37 callback_factory_.Initialize(this); | 38 callback_factory_.Initialize(this); |
| 38 } | 39 } |
| 39 | 40 |
| 40 TestingInstance::~TestingInstance() { | 41 TestingInstance::~TestingInstance() { |
| 41 if (current_case_) | 42 if (current_case_) |
| 42 delete current_case_; | 43 delete current_case_; |
| 43 } | 44 } |
| 44 | 45 |
| 45 bool TestingInstance::Init(uint32_t argc, | 46 bool TestingInstance::Init(uint32_t argc, |
| 46 const char* argn[], | 47 const char* argn[], |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 else { | 173 else { |
| 173 // Automated PyAuto tests rely on finding the exact strings below. | 174 // Automated PyAuto tests rely on finding the exact strings below. |
| 174 LogHTML(errors_.empty() ? | 175 LogHTML(errors_.empty() ? |
| 175 "<span class=\"pass\">[SHUTDOWN]</span> All tests passed." : | 176 "<span class=\"pass\">[SHUTDOWN]</span> All tests passed." : |
| 176 "<span class=\"fail\">[SHUTDOWN]</span> Some tests failed."); | 177 "<span class=\"fail\">[SHUTDOWN]</span> Some tests failed."); |
| 177 } | 178 } |
| 178 } | 179 } |
| 179 | 180 |
| 180 // Declare we're done by setting a cookie to either "PASS" or the errors. | 181 // Declare we're done by setting a cookie to either "PASS" or the errors. |
| 181 ReportProgress(errors_.empty() ? "PASS" : errors_); | 182 ReportProgress(errors_.empty() ? "PASS" : errors_); |
| 182 SendTestCommand("DidExecuteTests"); | 183 if (remove_plugin_) |
| 184 SendTestCommand("DidExecuteTests"); |
| 183 // Note, DidExecuteTests unloads the plugin. We can't really do anthing after | 185 // Note, DidExecuteTests unloads the plugin. We can't really do anthing after |
| 184 // this point. | 186 // this point. |
| 185 } | 187 } |
| 186 | 188 |
| 187 TestCase* TestingInstance::CaseForTestName(const std::string& name) { | 189 TestCase* TestingInstance::CaseForTestName(const std::string& name) { |
| 188 std::string case_name = name.substr(0, name.find_first_of('_')); | 190 std::string case_name = name.substr(0, name.find_first_of('_')); |
| 189 TestCaseFactory* iter = TestCaseFactory::head_; | 191 TestCaseFactory* iter = TestCaseFactory::head_; |
| 190 while (iter != NULL) { | 192 while (iter != NULL) { |
| 191 if (case_name == iter->name_) | 193 if (case_name == iter->name_) |
| 192 return iter->method_(this); | 194 return iter->method_(this); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 277 } |
| 276 }; | 278 }; |
| 277 | 279 |
| 278 namespace pp { | 280 namespace pp { |
| 279 | 281 |
| 280 Module* CreateModule() { | 282 Module* CreateModule() { |
| 281 return new ::Module(); | 283 return new ::Module(); |
| 282 } | 284 } |
| 283 | 285 |
| 284 } // namespace pp | 286 } // namespace pp |
| OLD | NEW |