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 kUnknownCommand = 9, | 13 kUnknownCommand = 9, |
14 kUnknownError = 13, | 14 kUnknownError = 13, |
15 kSessionNotCreatedException = 33, | 15 kSessionNotCreatedException = 33, |
16 kNoSuchSession = 100 | 16 // Chrome-specific status codes. |
| 17 kNoSuchSession = 100, |
| 18 kChromeNotReachable, |
17 }; | 19 }; |
18 | 20 |
19 // Represents a WebDriver status, which may be an error or ok. | 21 // Represents a WebDriver status, which may be an error or ok. |
20 class Status { | 22 class Status { |
21 public: | 23 public: |
22 explicit Status(StatusCode code); | 24 explicit Status(StatusCode code); |
23 Status(StatusCode code, const std::string& details); | 25 Status(StatusCode code, const std::string& details); |
| 26 Status(StatusCode code, const Status& cause); |
| 27 Status(StatusCode code, const std::string& details, const Status& cause); |
| 28 ~Status(); |
24 | 29 |
25 bool IsOk() const; | 30 bool IsOk() const; |
26 bool IsError() const; | 31 bool IsError() const; |
27 | 32 |
28 StatusCode code() const; | 33 StatusCode code() const; |
29 | 34 |
30 const std::string& message() const; | 35 const std::string& message() const; |
31 | 36 |
32 private: | 37 private: |
33 StatusCode code_; | 38 StatusCode code_; |
34 std::string msg_; | 39 std::string msg_; |
35 }; | 40 }; |
36 | 41 |
37 #endif // CHROME_TEST_CHROMEDRIVER_STATUS_H_ | 42 #endif // CHROME_TEST_CHROMEDRIVER_STATUS_H_ |
OLD | NEW |