| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/shell/renderer/test_runner/event_sender.h" | 5 #include "content/shell/renderer/test_runner/event_sender.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "content/public/common/page_zoom.h" | 10 #include "content/public/common/page_zoom.h" |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 } else if ("leftShift" == code_str) { | 1260 } else if ("leftShift" == code_str) { |
| 1261 code = ui::VKEY_LSHIFT; | 1261 code = ui::VKEY_LSHIFT; |
| 1262 } else if ("rightShift" == code_str) { | 1262 } else if ("rightShift" == code_str) { |
| 1263 code = ui::VKEY_RSHIFT; | 1263 code = ui::VKEY_RSHIFT; |
| 1264 } else if ("leftAlt" == code_str) { | 1264 } else if ("leftAlt" == code_str) { |
| 1265 code = ui::VKEY_LMENU; | 1265 code = ui::VKEY_LMENU; |
| 1266 } else if ("rightAlt" == code_str) { | 1266 } else if ("rightAlt" == code_str) { |
| 1267 code = ui::VKEY_RMENU; | 1267 code = ui::VKEY_RMENU; |
| 1268 } else if ("numLock" == code_str) { | 1268 } else if ("numLock" == code_str) { |
| 1269 code = ui::VKEY_NUMLOCK; | 1269 code = ui::VKEY_NUMLOCK; |
| 1270 } else if ("backspace" == code_str) { |
| 1271 code = ui::VKEY_BACK; |
| 1272 } else if ("escape" == code_str) { |
| 1273 code = ui::VKEY_ESCAPE; |
| 1270 } else { | 1274 } else { |
| 1271 // Compare the input string with the function-key names defined by the | 1275 // Compare the input string with the function-key names defined by the |
| 1272 // DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key | 1276 // DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key |
| 1273 // name, set its key code. | 1277 // name, set its key code. |
| 1274 for (int i = 1; i <= 24; ++i) { | 1278 for (int i = 1; i <= 24; ++i) { |
| 1275 std::string function_key_name = base::StringPrintf("F%d", i); | 1279 std::string function_key_name = base::StringPrintf("F%d", i); |
| 1276 if (function_key_name == code_str) { | 1280 if (function_key_name == code_str) { |
| 1277 code = ui::VKEY_F1 + (i - 1); | 1281 code = ui::VKEY_F1 + (i - 1); |
| 1278 break; | 1282 break; |
| 1279 } | 1283 } |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 case WebInputEvent::GestureScrollBegin: | 1943 case WebInputEvent::GestureScrollBegin: |
| 1940 current_gesture_location_ = WebPoint(point.x, point.y); | 1944 current_gesture_location_ = WebPoint(point.x, point.y); |
| 1941 event.x = current_gesture_location_.x; | 1945 event.x = current_gesture_location_.x; |
| 1942 event.y = current_gesture_location_.y; | 1946 event.y = current_gesture_location_.y; |
| 1943 break; | 1947 break; |
| 1944 case WebInputEvent::GestureScrollEnd: | 1948 case WebInputEvent::GestureScrollEnd: |
| 1945 case WebInputEvent::GestureFlingStart: | 1949 case WebInputEvent::GestureFlingStart: |
| 1946 event.x = current_gesture_location_.x; | 1950 event.x = current_gesture_location_.x; |
| 1947 event.y = current_gesture_location_.y; | 1951 event.y = current_gesture_location_.y; |
| 1948 break; | 1952 break; |
| 1949 case WebInputEvent::GestureTap: | 1953 case WebInputEvent::GestureTap: |
| 1950 { | 1954 { |
| 1951 float tap_count = 1; | 1955 float tap_count = 1; |
| 1952 float width = 30; | 1956 float width = 30; |
| 1953 float height = 30; | 1957 float height = 30; |
| 1954 if (!args->PeekNext().IsEmpty()) { | 1958 if (!args->PeekNext().IsEmpty()) { |
| 1955 if (!args->GetNext(&tap_count)) { | 1959 if (!args->GetNext(&tap_count)) { |
| 1956 args->ThrowError(); | 1960 args->ThrowError(); |
| 1957 return; | 1961 return; |
| 1958 } | 1962 } |
| 1959 } | 1963 } |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2284 } | 2288 } |
| 2285 default: | 2289 default: |
| 2286 NOTREACHED(); | 2290 NOTREACHED(); |
| 2287 } | 2291 } |
| 2288 } | 2292 } |
| 2289 | 2293 |
| 2290 replaying_saved_events_ = false; | 2294 replaying_saved_events_ = false; |
| 2291 } | 2295 } |
| 2292 | 2296 |
| 2293 } // namespace content | 2297 } // namespace content |
| OLD | NEW |