OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef WEBKIT_PLUGINS_NPAPI_TEST_PLUGIN_TEST_H_ | 5 #ifndef WEBKIT_PLUGINS_NPAPI_TEST_PLUGIN_TEST_H_ |
6 #define WEBKIT_PLUGINS_NPAPI_TEST_PLUGIN_TEST_H_ | 6 #define WEBKIT_PLUGINS_NPAPI_TEST_PLUGIN_TEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "third_party/npapi/bindings/npapi.h" | 10 #include "third_party/npapi/bindings/npapi.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 const std::string &val2); | 57 const std::string &val2); |
58 | 58 |
59 // Expect two values to not be equal, and if they are | 59 // Expect two values to not be equal, and if they are |
60 // logs an appropriate error about it. | 60 // logs an appropriate error about it. |
61 void ExpectAsciiStringNotEqual(const char *val1, const char *val2); | 61 void ExpectAsciiStringNotEqual(const char *val1, const char *val2); |
62 | 62 |
63 // Expect two integer values are equal, and if not, logs an | 63 // Expect two integer values are equal, and if not, logs an |
64 // appropriate error about it. | 64 // appropriate error about it. |
65 void ExpectIntegerEqual(int val1, int val2); | 65 void ExpectIntegerEqual(int val1, int val2); |
66 | 66 |
67 protected: | |
68 // Signals to the Test that invoked us that the test is | 67 // Signals to the Test that invoked us that the test is |
69 // completed. This is done by forcing the plugin to | 68 // completed. This is done by forcing the plugin to |
70 // set a cookie in the browser window, which the test program | 69 // set a cookie in the browser window, which the test program |
71 // is waiting for. Note - because this is done by | 70 // is waiting for. Note - because this is done by |
72 // using javascript, the browser must have the frame | 71 // using javascript, the browser must have the frame |
73 // setup before the plugin calls this function. So plugin | 72 // setup before the plugin calls this function. So plugin |
74 // tests MUST NOT call this function prior to having | 73 // tests MUST NOT call this function prior to having |
75 // received the SetWindow() callback from the browser. | 74 // received the SetWindow() callback from the browser. |
76 void SignalTestCompleted(); | 75 void SignalTestCompleted(); |
77 | 76 |
| 77 protected: |
78 // Helper function to lookup names in the input array. | 78 // Helper function to lookup names in the input array. |
79 // If the name is found, returns the value, otherwise | 79 // If the name is found, returns the value, otherwise |
80 // returns NULL. | 80 // returns NULL. |
81 const char *GetArgValue(const char *name, const int16 argc, | 81 const char *GetArgValue(const char *name, const int16 argc, |
82 const char *argn[], const char *argv[]); | 82 const char *argn[], const char *argv[]); |
83 | 83 |
84 // Access to the list of functions provided | 84 // Access to the list of functions provided |
85 // by the NPAPI host. | 85 // by the NPAPI host. |
86 NPNetscapeFuncs *HostFunctions() { return host_functions_; } | 86 NPNetscapeFuncs *HostFunctions() { return host_functions_; } |
87 | 87 |
88 // The NPP Identifier for this plugin instance. | 88 // The NPP Identifier for this plugin instance. |
89 NPP id() { return id_; } | 89 NPP id() { return id_; } |
90 std::string test_id() const { return test_id_; } | 90 std::string test_id() const { return test_id_; } |
91 std::string test_name() const { return test_name_; } | 91 std::string test_name() const { return test_name_; } |
92 bool test_completed() const { return test_completed_; } | 92 bool test_completed() const { return test_completed_; } |
93 private: | 93 private: |
94 NPP id_; | 94 NPP id_; |
95 NPNetscapeFuncs * host_functions_; | 95 NPNetscapeFuncs * host_functions_; |
96 std::string test_name_; | 96 std::string test_name_; |
97 std::string test_id_; | 97 std::string test_id_; |
98 std::string test_status_; | 98 std::string test_status_; |
99 bool test_completed_; | 99 bool test_completed_; |
100 }; | 100 }; |
101 | 101 |
102 } // namespace NPAPIClient | 102 } // namespace NPAPIClient |
103 | 103 |
104 #endif // WEBKIT_PLUGINS_NPAPI_TEST_PLUGIN_TEST_H_ | 104 #endif // WEBKIT_PLUGINS_NPAPI_TEST_PLUGIN_TEST_H_ |
OLD | NEW |