| 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 #include "chrome/test/webdriver/webdriver_error.h" | 5 #include "chrome/test/webdriver/webdriver_error.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "chrome/common/automation_constants.h" | 9 #include "chrome/common/automation_constants.h" |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // static | 55 // static |
| 56 Error* Error::FromAutomationError(const automation::Error& error) { | 56 Error* Error::FromAutomationError(const automation::Error& error) { |
| 57 ErrorCode code = kUnknownError; | 57 ErrorCode code = kUnknownError; |
| 58 switch (error.code()) { | 58 switch (error.code()) { |
| 59 case automation::kNoJavaScriptModalDialogOpen: | 59 case automation::kNoJavaScriptModalDialogOpen: |
| 60 code = kNoAlertOpenError; | 60 code = kNoAlertOpenError; |
| 61 break; | 61 break; |
| 62 case automation::kBlockedByModalDialog: | 62 case automation::kBlockedByModalDialog: |
| 63 code = kUnexpectedAlertOpen; | 63 code = kUnexpectedAlertOpen; |
| 64 break; | 64 break; |
| 65 case automation::kInvalidId: |
| 66 code = kNoSuchWindow; |
| 65 default: | 67 default: |
| 66 break; | 68 break; |
| 67 } | 69 } |
| 68 | 70 |
| 69 // In Chrome 17 and before, the automation error was just a string. | 71 // In Chrome 17 and before, the automation error was just a string. |
| 70 // Compare against some strings that correspond to webdriver errors. | 72 // Compare against some strings that correspond to webdriver errors. |
| 71 // TODO(kkania): Remove these comparisons when Chrome 17 is unsupported. | 73 // TODO(kkania): Remove these comparisons when Chrome 17 is unsupported. |
| 72 if (code == kUnknownError) { | 74 if (code == kUnknownError) { |
| 73 if (error.message() == | 75 if (error.message() == |
| 74 "Command cannot be performed because a modal dialog is active" || | 76 "Command cannot be performed because a modal dialog is active" || |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 112 |
| 111 ErrorCode Error::code() const { | 113 ErrorCode Error::code() const { |
| 112 return code_; | 114 return code_; |
| 113 } | 115 } |
| 114 | 116 |
| 115 const std::string& Error::details() const { | 117 const std::string& Error::details() const { |
| 116 return details_; | 118 return details_; |
| 117 } | 119 } |
| 118 | 120 |
| 119 } // namespace webdriver | 121 } // namespace webdriver |
| OLD | NEW |