| 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 CHROME_TEST_AUTOMATION_DOM_ELEMENT_PROXY_H_ | 5 #ifndef CHROME_TEST_AUTOMATION_DOM_ELEMENT_PROXY_H_ |
| 6 #define CHROME_TEST_AUTOMATION_DOM_ELEMENT_PROXY_H_ | 6 #define CHROME_TEST_AUTOMATION_DOM_ELEMENT_PROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 bool GetProperty(const std::string& property, | 137 bool GetProperty(const std::string& property, |
| 138 std::string* out); | 138 std::string* out); |
| 139 | 139 |
| 140 // Gets the element's value for its |attribute|. Returns true on success. | 140 // Gets the element's value for its |attribute|. Returns true on success. |
| 141 bool GetAttribute(const std::string& attribute, | 141 bool GetAttribute(const std::string& attribute, |
| 142 std::string* out); | 142 std::string* out); |
| 143 | 143 |
| 144 // Retrieves all the text in this element. This includes the value | 144 // Retrieves all the text in this element. This includes the value |
| 145 // of textfields and inputs. Returns true on success. | 145 // of textfields and inputs. Returns true on success. |
| 146 bool GetText(std::string* text); | 146 bool GetText(std::string* text); |
| 147 bool GetInnerText(std::string* text); |
| 147 | 148 |
| 148 // Retrieves the element's inner HTML. Returns true on success. | 149 // Retrieves the element's inner HTML. Returns true on success. |
| 149 bool GetInnerHTML(std::string* html); | 150 bool GetInnerHTML(std::string* html); |
| 150 | 151 |
| 151 // Retrieves the element's id. Returns true on success. | 152 // Retrieves the element's id. Returns true on success. |
| 152 bool GetId(std::string* id); | 153 bool GetId(std::string* id); |
| 153 | 154 |
| 154 // Retrieves the element's name. Returns true on success. | 155 // Retrieves the element's name. Returns true on success. |
| 155 bool GetName(std::string* name); | 156 bool GetName(std::string* name); |
| 156 | 157 |
| 157 // Retrieves the element's visibility. Returns true on success. | 158 // Retrieves the element's visibility. Returns true on success. |
| 158 bool GetVisibility(bool* visilibity); | 159 bool GetVisibility(bool* visilibity); |
| 159 | 160 |
| 160 // Returns if |expected_value| eventually matches the element's value for | 161 // Returns if |expected_value| eventually matches the element's value for |
| 161 // |attribute|. This function will block until the timeout is exceeded, in | 162 // |attribute|. This function will block until the timeout is exceeded, in |
| 162 // which case it will fail, or until the two values match. | 163 // which case it will fail, or until the two values match. |
| 163 bool DoesAttributeEventuallyMatch(const std::string& attribute, | 164 bool DoesAttributeEventuallyMatch(const std::string& attribute, |
| 164 const std::string& expected_value); | 165 const std::string& expected_value); |
| 165 | 166 |
| 166 private: | 167 private: |
| 167 // Gets the element's value for the given type. This is a helper method | 168 // Gets the element's value for the given type. This is a helper method |
| 168 // for simple get methods. | 169 // for simple get methods. |
| 169 template <typename T> | 170 template <typename T> |
| 170 bool GetValue(const std::string& type, T* out); | 171 bool GetValue(const std::string& type, T* out); |
| 171 | 172 |
| 172 DISALLOW_COPY_AND_ASSIGN(DOMElementProxy); | 173 DISALLOW_COPY_AND_ASSIGN(DOMElementProxy); |
| 173 }; | 174 }; |
| 174 | 175 |
| 175 #endif // CHROME_TEST_AUTOMATION_DOM_ELEMENT_PROXY_H_ | 176 #endif // CHROME_TEST_AUTOMATION_DOM_ELEMENT_PROXY_H_ |
| OLD | NEW |