diff options
author | miket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 16:59:04 +0000 |
---|---|---|
committer | miket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 16:59:04 +0000 |
commit | 8c8359ee20b952a54b3afb105b021c6e79f49ba1 (patch) | |
tree | 3a4650a41e01dc12b6c01a57d74691487e5b681b /chrome/test/data | |
parent | 7e2163b9fdac01f8f90bebe109295c6c0f457b3a (diff) | |
download | chromium_src-8c8359ee20b952a54b3afb105b021c6e79f49ba1.zip chromium_src-8c8359ee20b952a54b3afb105b021c6e79f49ba1.tar.gz chromium_src-8c8359ee20b952a54b3afb105b021c6e79f49ba1.tar.bz2 |
Add bitrate option to serial API.
- Migrate more code over to the new-style argument parsing code.
- Fix some browser tests whose arguments didn't get updated with the socket.create() signature change.
- Change default to 9600 bps.
- Moved the sample Arduino sketch out of comments into a separate file.
BUG=120508
TEST=added
TBR=penghuang@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10694061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145684 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/data')
-rw-r--r-- | chrome/test/data/extensions/api_test/serial/api/background.js | 7 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/serial/api/serial_arduino_test.ino | 17 |
2 files changed, 22 insertions, 2 deletions
diff --git a/chrome/test/data/extensions/api_test/serial/api/background.js b/chrome/test/data/extensions/api_test/serial/api/background.js index e241d56..76e9239 100644 --- a/chrome/test/data/extensions/api_test/serial/api/background.js +++ b/chrome/test/data/extensions/api_test/serial/api/background.js @@ -136,8 +136,11 @@ var testSerial = function() { } if (portNumber < ports.length) { serialPort = ports[portNumber]; - console.log('Connecting to serial device at ' + serialPort); - chrome.experimental.serial.open(serialPort, onOpen); + var bitrate = 57600; + console.log('Connecting to serial device ' + serialPort + ' at ' + + bitrate + ' bps.'); + chrome.experimental.serial.open(serialPort, {bitrate: bitrate}, + onOpen); } else { // We didn't find a port that we think we should try. chrome.test.succeed(); diff --git a/chrome/test/data/extensions/api_test/serial/api/serial_arduino_test.ino b/chrome/test/data/extensions/api_test/serial/api/serial_arduino_test.ino new file mode 100644 index 0000000..5fcb894 --- /dev/null +++ b/chrome/test/data/extensions/api_test/serial/api/serial_arduino_test.ino @@ -0,0 +1,17 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <Arduino.h> + +// This Arduino sketch is used for manual testing with the browser test +// SerialApiTest.SerialExtension. We have tested with Arduino IDE 1.0.1. + +void setup() { + Serial.begin(57600); +} + +void loop() { + if (Serial.available() > 0) + Serial.print((char)Serial.read()); +} |