| 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 #ifndef CHROME_TEST_CHROMEDRIVER_STATUS_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_STATUS_H_ |
| 6 #define CHROME_TEST_CHROMEDRIVER_STATUS_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_STATUS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 // WebDriver standard status codes. | 10 // WebDriver standard status codes. |
| 11 enum StatusCode { | 11 enum StatusCode { |
| 12 kOk = 0, | 12 kOk = 0, |
| 13 kNoSuchElement = 7, | 13 kNoSuchElement = 7, |
| 14 kUnknownCommand = 9, | 14 kUnknownCommand = 9, |
| 15 kStaleElementReference = 10, | 15 kStaleElementReference = 10, |
| 16 kElementNotVisible = 11, | 16 kElementNotVisible = 11, |
| 17 kInvalidElementState = 12, | 17 kInvalidElementState = 12, |
| 18 kUnknownError = 13, | 18 kUnknownError = 13, |
| 19 kXPathLookupError = 19, | 19 kXPathLookupError = 19, |
| 20 kInvalidSelector = 32, | 20 kInvalidSelector = 32, |
| 21 kSessionNotCreatedException = 33, | 21 kSessionNotCreatedException = 33, |
| 22 // Chrome-specific status codes. | 22 // Chrome-specific status codes. |
| 23 kNoSuchSession = 100, | 23 kNoSuchSession = 100, |
| 24 kNoSuchFrame, |
| 24 kChromeNotReachable, | 25 kChromeNotReachable, |
| 25 kDisconnected, | 26 kDisconnected, |
| 26 }; | 27 }; |
| 27 | 28 |
| 28 // Represents a WebDriver status, which may be an error or ok. | 29 // Represents a WebDriver status, which may be an error or ok. |
| 29 class Status { | 30 class Status { |
| 30 public: | 31 public: |
| 31 explicit Status(StatusCode code); | 32 explicit Status(StatusCode code); |
| 32 Status(StatusCode code, const std::string& details); | 33 Status(StatusCode code, const std::string& details); |
| 33 Status(StatusCode code, const Status& cause); | 34 Status(StatusCode code, const Status& cause); |
| 34 Status(StatusCode code, const std::string& details, const Status& cause); | 35 Status(StatusCode code, const std::string& details, const Status& cause); |
| 35 ~Status(); | 36 ~Status(); |
| 36 | 37 |
| 37 bool IsOk() const; | 38 bool IsOk() const; |
| 38 bool IsError() const; | 39 bool IsError() const; |
| 39 | 40 |
| 40 StatusCode code() const; | 41 StatusCode code() const; |
| 41 | 42 |
| 42 const std::string& message() const; | 43 const std::string& message() const; |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 StatusCode code_; | 46 StatusCode code_; |
| 46 std::string msg_; | 47 std::string msg_; |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 #endif // CHROME_TEST_CHROMEDRIVER_STATUS_H_ | 50 #endif // CHROME_TEST_CHROMEDRIVER_STATUS_H_ |
| OLD | NEW |