Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: chrome/test/webdriver/commands/command.h

Issue 6532068: Fix a bug in ImplicitWaitCommand: we must explicitly check if the ms param... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Reverting changes added while debugging Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 CHROME_TEST_WEBDRIVER_COMMANDS_COMMAND_H_ 5 #ifndef CHROME_TEST_WEBDRIVER_COMMANDS_COMMAND_H_
6 #define CHROME_TEST_WEBDRIVER_COMMANDS_COMMAND_H_ 6 #define CHROME_TEST_WEBDRIVER_COMMANDS_COMMAND_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 protected: 48 protected:
49 49
50 // Returns the path variable encoded at the |i|th index (0-based) in the 50 // Returns the path variable encoded at the |i|th index (0-based) in the
51 // request URL for this command. If the index is out of bounds, an empty 51 // request URL for this command. If the index is out of bounds, an empty
52 // string will be returned. 52 // string will be returned.
53 inline std::string GetPathVariable(const size_t i) const { 53 inline std::string GetPathVariable(const size_t i) const {
54 return i < path_segments_.size() ? path_segments_.at(i) : ""; 54 return i < path_segments_.size() ? path_segments_.at(i) : "";
55 } 55 }
56 56
57 // Returns whether the command has a parameter with the given |key|.
58 bool HasParameter(const std::string& key) const;
59
57 // Returns true if the command parameter with the given |key| exists and is 60 // Returns true if the command parameter with the given |key| exists and is
58 // a null value. 61 // a null value.
59 bool IsNullParameter(const std::string& key) const; 62 bool IsNullParameter(const std::string& key) const;
60 63
61 // Returns the command parameter with the given |key| as a UTF-16 string. 64 // Returns the command parameter with the given |key| as a UTF-16 string.
62 // Returns true on success. 65 // Returns true on success.
63 bool GetStringParameter(const std::string& key, string16* out) const; 66 bool GetStringParameter(const std::string& key, string16* out) const;
64 67
65 // Provides the command parameter with the given |key| as a UTF-8 string. 68 // Provides the command parameter with the given |key| as a UTF-8 string.
66 // Returns true on success. 69 // Returns true on success.
67 bool GetStringParameter(const std::string& key, std::string* out) const; 70 bool GetStringParameter(const std::string& key, std::string* out) const;
68 71
69 // Provides the command parameter with the given |key| as a ASCII string. 72 // Provides the command parameter with the given |key| as a ASCII string.
70 // Returns true on success. 73 // Returns true on success.
71 bool GetStringASCIIParameter(const std::string& key, std::string* out) const; 74 bool GetStringASCIIParameter(const std::string& key, std::string* out) const;
72 75
73 // Provides the command parameter with the given |key| as a boolean. Returns 76 // Provides the command parameter with the given |key| as a boolean. Returns
74 // false if there is no such parameter, or if it is not a boolean. 77 // false if there is no such parameter, or if it is not a boolean.
75 bool GetBooleanParameter(const std::string& key, bool* out) const; 78 bool GetBooleanParameter(const std::string& key, bool* out) const;
76 79
77 // Provides the command parameter with the given |key| as a int. Returns 80 // Provides the command parameter with the given |key| as a int. Returns
78 // false if there is no such parameter, or if it is not a int. 81 // false if there is no such parameter, or if it is not a int.
79 bool GetIntegerParameter(const std::string& key, int* out) const; 82 bool GetIntegerParameter(const std::string& key, int* out) const;
80 83
84 // Provides the command parameter with the given |key| as a double. Returns
85 // false if there is no such parameter, or if it is not a dobule.
86 bool GetDoubleParameter(const std::string& key, double* out) const;
87
81 // Provides the command parameter with the given |key| as a Dictionary. 88 // Provides the command parameter with the given |key| as a Dictionary.
82 // Returns false if there is no such parameter, or if it is not a Dictionary. 89 // Returns false if there is no such parameter, or if it is not a Dictionary.
83 bool GetDictionaryParameter(const std::string& key, 90 bool GetDictionaryParameter(const std::string& key,
84 DictionaryValue** out) const; 91 DictionaryValue** out) const;
85 92
86 // Provides the command parameter with the given |key| as a list. Returns 93 // Provides the command parameter with the given |key| as a list. Returns
87 // false if there is no such parameter, or if it is not a list. 94 // false if there is no such parameter, or if it is not a list.
88 bool GetListParameter(const std::string& key, ListValue** out) const; 95 bool GetListParameter(const std::string& key, ListValue** out) const;
89 96
90 private: 97 private:
91 const std::vector<std::string> path_segments_; 98 const std::vector<std::string> path_segments_;
92 const scoped_ptr<const DictionaryValue> parameters_; 99 const scoped_ptr<const DictionaryValue> parameters_;
93 100
94 // An autorelease pool must exist on any thread where Objective C is used, 101 // An autorelease pool must exist on any thread where Objective C is used,
95 // even implicitly. Otherwise the warning: 102 // even implicitly. Otherwise the warning:
96 // "Objects autoreleased with no pool in place." 103 // "Objects autoreleased with no pool in place."
97 // is printed for every object deallocted. Since every incomming command to 104 // is printed for every object deallocted. Since every incomming command to
98 // chrome driver is allocated a new thread, the release pool is declared here. 105 // chrome driver is allocated a new thread, the release pool is declared here.
99 base::mac::ScopedNSAutoreleasePool autorelease_pool; 106 base::mac::ScopedNSAutoreleasePool autorelease_pool;
100 107
101 DISALLOW_COPY_AND_ASSIGN(Command); 108 DISALLOW_COPY_AND_ASSIGN(Command);
102 }; 109 };
103 110
104 } // namespace webdriver 111 } // namespace webdriver
105 112
106 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_COMMAND_H_ 113 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_COMMAND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698