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/commands/alert_commands.h" | 5 #include "chrome/test/webdriver/commands/alert_commands.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/test/webdriver/commands/response.h" | 8 #include "chrome/test/webdriver/commands/response.h" |
9 #include "chrome/test/webdriver/session.h" | 9 #include "chrome/test/webdriver/session.h" |
10 #include "chrome/test/webdriver/webdriver_error.h" | 10 #include "chrome/test/webdriver/webdriver_error.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 return true; | 28 return true; |
29 } | 29 } |
30 | 30 |
31 void AlertTextCommand::ExecuteGet(Response* const response) { | 31 void AlertTextCommand::ExecuteGet(Response* const response) { |
32 std::string text; | 32 std::string text; |
33 Error* error = session_->GetAlertMessage(&text); | 33 Error* error = session_->GetAlertMessage(&text); |
34 if (error) { | 34 if (error) { |
35 response->SetError(error); | 35 response->SetError(error); |
36 return; | 36 return; |
37 } | 37 } |
38 response->SetValue(Value::CreateStringValue(text)); | 38 response->SetValue(base::StringValue::New(text)); |
39 } | 39 } |
40 | 40 |
41 void AlertTextCommand::ExecutePost(Response* const response) { | 41 void AlertTextCommand::ExecutePost(Response* const response) { |
42 std::string text; | 42 std::string text; |
43 if (!GetStringParameter("text", &text)) { | 43 if (!GetStringParameter("text", &text)) { |
44 response->SetError(new Error( | 44 response->SetError(new Error( |
45 kBadRequest, "'text' is missing or invalid")); | 45 kBadRequest, "'text' is missing or invalid")); |
46 return; | 46 return; |
47 } | 47 } |
48 Error* error = session_->SetAlertPromptText(text); | 48 Error* error = session_->SetAlertPromptText(text); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 return true; | 82 return true; |
83 } | 83 } |
84 | 84 |
85 void DismissAlertCommand::ExecutePost(Response* const response) { | 85 void DismissAlertCommand::ExecutePost(Response* const response) { |
86 Error* error = session_->AcceptOrDismissAlert(false); | 86 Error* error = session_->AcceptOrDismissAlert(false); |
87 if (error) | 87 if (error) |
88 response->SetError(error); | 88 response->SetError(error); |
89 } | 89 } |
90 | 90 |
91 } // namespace webdriver | 91 } // namespace webdriver |
OLD | NEW |