Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: content/shell/renderer/test_runner/event_sender.cc

Issue 1140813007: Fix cluster-fuzz crash with internal EventSender API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 std::string function_key_name = base::StringPrintf("F%d", i); 1368 std::string function_key_name = base::StringPrintf("F%d", i);
1369 if (function_key_name == code_str) { 1369 if (function_key_name == code_str) {
1370 code = ui::VKEY_F1 + (i - 1); 1370 code = ui::VKEY_F1 + (i - 1);
1371 domString = function_key_name; 1371 domString = function_key_name;
1372 break; 1372 break;
1373 } 1373 }
1374 } 1374 }
1375 if (!code) { 1375 if (!code) {
1376 WebString web_code_str = 1376 WebString web_code_str =
1377 WebString::fromUTF8(code_str.data(), code_str.size()); 1377 WebString::fromUTF8(code_str.data(), code_str.size());
1378 DCHECK_EQ(1u, web_code_str.length()); 1378 if (web_code_str.length() != 1u) {
1379 v8::Isolate* isolate = blink::mainThreadIsolate();
1380 isolate->ThrowException(v8::Exception::TypeError(
1381 gin::StringToV8(isolate, "Invalid web code.")));
1382 return;
1383 }
1379 text = code = web_code_str.at(0); 1384 text = code = web_code_str.at(0);
1380 needs_shift_key_modifier = NeedsShiftModifier(code); 1385 needs_shift_key_modifier = NeedsShiftModifier(code);
1381 if ((code & 0xFF) >= 'a' && (code & 0xFF) <= 'z') 1386 if ((code & 0xFF) >= 'a' && (code & 0xFF) <= 'z')
1382 code -= 'a' - 'A'; 1387 code -= 'a' - 'A';
1383 if ((code >= 'A' && code <= 'Z') || (code >= 'a' && code <= 'z')) { 1388 if ((code >= 'A' && code <= 'Z') || (code >= 'a' && code <= 'z')) {
1384 domString.assign("Key"); 1389 domString.assign("Key");
1385 domString.push_back(base::ToUpperASCII(code)); 1390 domString.push_back(base::ToUpperASCII(code));
1386 } else if (code >= '0' && code <= '9') { 1391 } else if (code >= '0' && code <= '9') {
1387 domString.assign("Digit"); 1392 domString.assign("Digit");
1388 domString.push_back(code); 1393 domString.push_back(code);
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2512 2517
2513 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { 2518 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) {
2514 if (WebPagePopup* popup = view_->pagePopup()) { 2519 if (WebPagePopup* popup = view_->pagePopup()) {
2515 if (!WebInputEvent::isKeyboardEventType(event.type)) 2520 if (!WebInputEvent::isKeyboardEventType(event.type))
2516 return popup->handleInputEvent(event); 2521 return popup->handleInputEvent(event);
2517 } 2522 }
2518 return view_->handleInputEvent(event); 2523 return view_->handleInputEvent(event);
2519 } 2524 }
2520 2525
2521 } // namespace content 2526 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698