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

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: Addressing initial code review comments 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} e The keypress event.
9 */
10 function handleTextareaKeyPressed(event) {
11 // If the "Enter" key is pressed
12 // then process the text in the textarea.
Jamie 2014/03/04 21:40:35 Nit: This comment is wrapped in an odd place.
chaitali 2014/03/05 22:02:22 Done.
13 if (event.which == 13) {
14 var testTextVal = document.getElementById('testtext').value;
15 var postParams = 'text=' + testTextVal;
16
17 var request = new XMLHttpRequest();
18 request.open('POST', '/keytest/test', true);
Jamie 2014/03/04 21:40:35 Can we use a relative URL here too?
chaitali 2014/03/05 22:02:22 Same comment. Removed the initial / if thats what
19 request.setRequestHeader(
20 'Content-type', 'application/x-www-form-urlencoded');
21
22 request.onreadystatechange = function() {
23 if(request.readyState == 4 && request.status == 200) {
24 console.log('Sent POST request to server.');
25 }
26 };
27
28 request.onerror = function() {
29 console.log('Request failed');
30 };
31
32 request.send(postParams);
33 }
34 };
35
36 window.addEventListener('load', function(){
37 document.getElementById('testtext').addEventListener(
38 'keypress',
39 handleTextareaKeyPressed,
40 false);
41 });
Jamie 2014/03/04 21:40:35 Missing 'false'.
chaitali 2014/03/05 22:02:22 Done.
42
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698