| 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 13 matching lines...) Expand all Loading... |
| 24 // failure. | 24 // failure. |
| 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 websocket_port_(-1) { | 35 websocket_port_(-1) { |
| 35 callback_factory_.Initialize(this); | 36 callback_factory_.Initialize(this); |
| 36 } | 37 } |
| 37 | 38 |
| 38 TestingInstance::~TestingInstance() { | 39 TestingInstance::~TestingInstance() { |
| 39 if (current_case_) | 40 if (current_case_) |
| 40 delete current_case_; | 41 delete current_case_; |
| 41 } | 42 } |
| 42 | 43 |
| 43 bool TestingInstance::Init(uint32_t argc, | 44 bool TestingInstance::Init(uint32_t argc, |
| 44 const char* argn[], | 45 const char* argn[], |
| 45 const char* argv[]) { | 46 const char* argv[]) { |
| 46 for (uint32_t i = 0; i < argc; i++) { | 47 for (uint32_t i = 0; i < argc; i++) { |
| 47 if (std::strcmp(argn[i], "mode") == 0) { | 48 if (std::strcmp(argn[i], "mode") == 0) { |
| 48 if (std::strcmp(argv[i], "nacl") == 0) | 49 if (std::strcmp(argv[i], "nacl") == 0) |
| 49 nacl_mode_ = true; | 50 nacl_mode_ = true; |
| 50 } else if (std::strcmp(argn[i], "protocol") == 0) { | 51 } else if (std::strcmp(argn[i], "protocol") == 0) { |
| 51 protocol_ = argv[i]; | 52 protocol_ = argv[i]; |
| 52 } else if (std::strcmp(argn[i], "websocket_port") == 0) { | 53 } else if (std::strcmp(argn[i], "websocket_port") == 0) { |
| 53 websocket_port_ = atoi(argv[i]); | 54 websocket_port_ = atoi(argv[i]); |
| 55 } else if (std::strcmp(argn[i], "ssl_server_port") == 0) { |
| 56 ssl_server_port_ = atoi(argv[i]); |
| 54 } | 57 } |
| 55 } | 58 } |
| 56 // Create the proper test case from the argument. | 59 // Create the proper test case from the argument. |
| 57 for (uint32_t i = 0; i < argc; i++) { | 60 for (uint32_t i = 0; i < argc; i++) { |
| 58 if (std::strcmp(argn[i], "testcase") == 0) { | 61 if (std::strcmp(argn[i], "testcase") == 0) { |
| 59 if (argv[i][0] == '\0') | 62 if (argv[i][0] == '\0') |
| 60 break; | 63 break; |
| 61 current_case_ = CaseForTestName(argv[i]); | 64 current_case_ = CaseForTestName(argv[i]); |
| 62 test_filter_ = FilterForTestName(argv[i]); | 65 test_filter_ = FilterForTestName(argv[i]); |
| 63 if (!current_case_) | 66 if (!current_case_) |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 264 } |
| 262 }; | 265 }; |
| 263 | 266 |
| 264 namespace pp { | 267 namespace pp { |
| 265 | 268 |
| 266 Module* CreateModule() { | 269 Module* CreateModule() { |
| 267 return new ::Module(); | 270 return new ::Module(); |
| 268 } | 271 } |
| 269 | 272 |
| 270 } // namespace pp | 273 } // namespace pp |
| OLD | NEW |