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