| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "base/stringprintf.h" |
| 7 | 8 |
| 8 #include "webkit/glue/plugins/test/plugin_arguments_test.h" | 9 #include "webkit/glue/plugins/test/plugin_arguments_test.h" |
| 9 | 10 |
| 10 namespace NPAPIClient { | 11 namespace NPAPIClient { |
| 11 | 12 |
| 12 PluginArgumentsTest::PluginArgumentsTest(NPP id, | 13 PluginArgumentsTest::PluginArgumentsTest(NPP id, |
| 13 NPNetscapeFuncs *host_functions) | 14 NPNetscapeFuncs *host_functions) |
| 14 : PluginTest(id, host_functions) { | 15 : PluginTest(id, host_functions) { |
| 15 } | 16 } |
| 16 | 17 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 38 const char *count_string = GetArgValue("count", argc, argn, argv); | 39 const char *count_string = GetArgValue("count", argc, argn, argv); |
| 39 if (count_string != NULL) { | 40 if (count_string != NULL) { |
| 40 int max_args = atoi(count_string); | 41 int max_args = atoi(count_string); |
| 41 | 42 |
| 42 const char *size_string = GetArgValue("size", argc, argn, argv); | 43 const char *size_string = GetArgValue("size", argc, argn, argv); |
| 43 ExpectAsciiStringNotEqual(size_string, (const char *)NULL); | 44 ExpectAsciiStringNotEqual(size_string, (const char *)NULL); |
| 44 if (size_string != NULL) { | 45 if (size_string != NULL) { |
| 45 int size = atoi(size_string); | 46 int size = atoi(size_string); |
| 46 | 47 |
| 47 for (int index = 1; index <= max_args; index++) { | 48 for (int index = 1; index <= max_args; index++) { |
| 48 std::string arg_name = StringPrintf("%s%d", "val", index); | 49 std::string arg_name = base::StringPrintf("%s%d", "val", index); |
| 49 const char *val_string = GetArgValue(arg_name.c_str(), argc, argn, | 50 const char *val_string = GetArgValue(arg_name.c_str(), argc, argn, |
| 50 argv); | 51 argv); |
| 51 ExpectAsciiStringNotEqual(val_string, (const char*)NULL); | 52 ExpectAsciiStringNotEqual(val_string, (const char*)NULL); |
| 52 if (val_string != NULL) | 53 if (val_string != NULL) |
| 53 ExpectIntegerEqual((int)strlen(val_string), (index*size)); | 54 ExpectIntegerEqual((int)strlen(val_string), (index*size)); |
| 54 } | 55 } |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 | 58 |
| 58 return PluginTest::New(mode, argc, argn, argv, saved); | 59 return PluginTest::New(mode, argc, argn, argv, saved); |
| 59 } | 60 } |
| 60 | 61 |
| 61 NPError PluginArgumentsTest::SetWindow(NPWindow* pNPWindow) { | 62 NPError PluginArgumentsTest::SetWindow(NPWindow* pNPWindow) { |
| 62 // This test just tests the arguments. We're done now. | 63 // This test just tests the arguments. We're done now. |
| 63 this->SignalTestCompleted(); | 64 this->SignalTestCompleted(); |
| 64 | 65 |
| 65 return NPERR_NO_ERROR; | 66 return NPERR_NO_ERROR; |
| 66 } | 67 } |
| 67 | 68 |
| 68 } // namespace NPAPIClient | 69 } // namespace NPAPIClient |
| OLD | NEW |