| 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 #include "chrome/test/chromedriver/status.h" | 5 #include "chrome/test/chromedriver/status.h" |
| 6 | 6 |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| 11 // Returns the string equivalent of the given |ErrorCode|. | 11 // Returns the string equivalent of the given |ErrorCode|. |
| 12 const char* DefaultMessageForStatusCode(StatusCode code) { | 12 const char* DefaultMessageForStatusCode(StatusCode code) { |
| 13 switch (code) { | 13 switch (code) { |
| 14 case kOk: | 14 case kOk: |
| 15 return "ok"; | 15 return "ok"; |
| 16 case kNoSuchElement: | 16 case kNoSuchElement: |
| 17 return "no such element"; | 17 return "no such element"; |
| 18 case kUnknownCommand: | 18 case kUnknownCommand: |
| 19 return "unknown command"; | 19 return "unknown command"; |
| 20 case kStaleElementReference: | 20 case kStaleElementReference: |
| 21 return "stale element reference"; | 21 return "stale element reference"; |
| 22 case kElementNotVisible: | 22 case kElementNotVisible: |
| 23 return "element not visible"; | 23 return "element not visible"; |
| 24 case kInvalidElementState: | 24 case kInvalidElementState: |
| 25 return "invalid element state"; | 25 return "invalid element state"; |
| 26 case kUnknownError: | 26 case kUnknownError: |
| 27 return "unknown error"; | 27 return "unknown error"; |
| 28 case kJavaScriptError: |
| 29 return "javascript error"; |
| 28 case kXPathLookupError: | 30 case kXPathLookupError: |
| 29 return "xpath lookup error"; | 31 return "xpath lookup error"; |
| 32 case kTimeout: |
| 33 return "asynchronous script timeout"; |
| 30 case kNoSuchWindow: | 34 case kNoSuchWindow: |
| 31 return "no such window"; | 35 return "no such window"; |
| 32 case kUnexpectedAlertOpen: | 36 case kUnexpectedAlertOpen: |
| 33 return "unexpected alert open"; | 37 return "unexpected alert open"; |
| 34 case kNoAlertOpen: | 38 case kNoAlertOpen: |
| 35 return "no alert open"; | 39 return "no alert open"; |
| 36 case kInvalidSelector: | 40 case kInvalidSelector: |
| 37 return "invalid selector"; | 41 return "invalid selector"; |
| 38 case kSessionNotCreatedException: | 42 case kSessionNotCreatedException: |
| 39 return "session not created exception"; | 43 return "session not created exception"; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 return code_ != kOk; | 91 return code_ != kOk; |
| 88 } | 92 } |
| 89 | 93 |
| 90 StatusCode Status::code() const { | 94 StatusCode Status::code() const { |
| 91 return code_; | 95 return code_; |
| 92 } | 96 } |
| 93 | 97 |
| 94 const std::string& Status::message() const { | 98 const std::string& Status::message() const { |
| 95 return msg_; | 99 return msg_; |
| 96 } | 100 } |
| OLD | NEW |