| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/speed_command.h" | 5 #include "chrome/test/webdriver/commands/speed_command.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/test/webdriver/commands/response.h" | 10 #include "chrome/test/webdriver/commands/response.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 bool SpeedCommand::DoesGet() { | 57 bool SpeedCommand::DoesGet() { |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool SpeedCommand::DoesPost() { | 61 bool SpeedCommand::DoesPost() { |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void SpeedCommand::ExecuteGet(Response* const response) { | 65 void SpeedCommand::ExecuteGet(Response* const response) { |
| 66 switch (session_->speed()) { | 66 switch (session_->Speed()) { |
| 67 case Session::kSlow: | 67 case Session::kSlow: |
| 68 response->SetValue(new StringValue("SLOW")); | 68 response->SetValue(new StringValue("SLOW")); |
| 69 response->SetStatus(kSuccess); | 69 response->SetStatus(kSuccess); |
| 70 break; | 70 break; |
| 71 | 71 |
| 72 case Session::kMedium: | 72 case Session::kMedium: |
| 73 response->SetValue(new StringValue("MEDIUM")); | 73 response->SetValue(new StringValue("MEDIUM")); |
| 74 response->SetStatus(kSuccess); | 74 response->SetStatus(kSuccess); |
| 75 break; | 75 break; |
| 76 | 76 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 void SpeedCommand::ExecutePost(Response* const response) { | 91 void SpeedCommand::ExecutePost(Response* const response) { |
| 92 if (speed_ == Session::kUnknown) { | 92 if (speed_ == Session::kUnknown) { |
| 93 SET_WEBDRIVER_ERROR(response, "Invalid speed requested", | 93 SET_WEBDRIVER_ERROR(response, "Invalid speed requested", |
| 94 kInternalServerError); | 94 kInternalServerError); |
| 95 return; | 95 return; |
| 96 } | 96 } |
| 97 | 97 |
| 98 session_->set_speed(speed_); | 98 session_->SetSpeed(speed_); |
| 99 response->SetValue(new StringValue("success")); | 99 response->SetValue(new StringValue("success")); |
| 100 response->SetStatus(kSuccess); | 100 response->SetStatus(kSuccess); |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool SpeedCommand::RequiresValidTab() { | 103 bool SpeedCommand::RequiresValidTab() { |
| 104 return true; | 104 return true; |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace webdriver | 107 } // namespace webdriver |
| 108 | 108 |
| OLD | NEW |