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