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

Side by Side Diff: chrome/test/remoting/http_server/hostpage.js

Issue 180273015: Simple HTTP server for Chromoting End-to-End tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing lint issues reported by gjslint Created 6 years, 9 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
OLDNEW
(Empty)
1 // Copyright (c) 2014 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 /**
6 * Keypress handler for the textarea. Sends the textarea value
7 * to the HTTP server when "Enter" key is pressed.
8 * @param {Event} event The keypress event.
9 */
10 function handleTextareaKeyPressed(event) {
11 // If the "Enter" key is pressed then process the text in the textarea.
12 if (event.which == 13) {
13 var testTextVal = document.getElementById('testtext').value;
14 var postParams = 'text=' + testTextVal;
15
16 var request = new XMLHttpRequest();
17 request.open('POST', 'keytest/test', true);
18 request.setRequestHeader(
19 'Content-type', 'application/x-www-form-urlencoded');
20
21 request.onreadystatechange = function() {
22 if (request.readyState == 4 && request.status == 200) {
23 console.log('Sent POST request to server.');
24 }
25 };
26
27 request.onerror = function() {
28 console.log('Request failed');
29 };
30
31 request.send(postParams);
32 }
33 }
34
35 window.addEventListener(
36 'load',
37 function() {
38 document.getElementById('testtext').addEventListener(
39 'keypress',
40 handleTextareaKeyPressed,
41 false);
42 },
43 false);
44
OLDNEW
« no previous file with comments | « chrome/test/remoting/http_server/hostpage.html ('k') | chrome/test/remoting/http_server/http_server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698