summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/api
diff options
context:
space:
mode:
authorsammc <sammc@chromium.org>2014-10-03 19:11:57 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-04 02:12:14 +0000
commit3daad1ed89cd32023624be98edaf051a0043ff5f (patch)
treec1d1fd4c9db4b9718f1598f72763ab3a78ecb7ff /extensions/renderer/api
parentc45bf4466615a88c3b22112e9766824af3116e4a (diff)
downloadchromium_src-3daad1ed89cd32023624be98edaf051a0043ff5f.zip
chromium_src-3daad1ed89cd32023624be98edaf051a0043ff5f.tar.gz
chromium_src-3daad1ed89cd32023624be98edaf051a0043ff5f.tar.bz2
Add serialization support to the JS serial connection client.
To support persistent serial connections on mojo, serial.Connection and its dependencies must be serializable to mojo structs so it can be stashed. This adds serialization support to serial.Connection. BUG=389016 Review URL: https://codereview.chromium.org/592263004 Cr-Commit-Position: refs/heads/master@{#298158}
Diffstat (limited to 'extensions/renderer/api')
-rw-r--r--extensions/renderer/api/serial/serial_api_unittest.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/extensions/renderer/api/serial/serial_api_unittest.cc b/extensions/renderer/api/serial/serial_api_unittest.cc
index bf14bf3..bc60b7d 100644
--- a/extensions/renderer/api/serial/serial_api_unittest.cc
+++ b/extensions/renderer/api/serial/serial_api_unittest.cc
@@ -407,6 +407,8 @@ class SerialApiTest : public ApiTestBase {
env()->RegisterModule("device/serial/data_stream_serialization.mojom",
IDR_DATA_STREAM_SERIALIZATION_MOJOM_JS);
env()->RegisterModule("device/serial/serial.mojom", IDR_SERIAL_MOJOM_JS);
+ env()->RegisterModule("device/serial/serial_serialization.mojom",
+ IDR_SERIAL_SERIALIZATION_MOJOM_JS);
service_provider()->AddService<device::serial::SerialService>(base::Bind(
&SerialApiTest::CreateSerialService, base::Unretained(this)));
}
@@ -465,6 +467,10 @@ TEST_F(SerialApiTest, GetInfo) {
RunTest("serial_unittest.js", "testGetInfo");
}
+TEST_F(SerialApiTest, GetInfoAfterSerialization) {
+ RunTest("serial_unittest.js", "testGetInfoAfterSerialization");
+}
+
TEST_F(SerialApiTest, GetInfoFailToGetPortInfo) {
io_handler_ = new FailToGetInfoTestIoHandler(1);
RunTest("serial_unittest.js", "testGetInfoFailToGetPortInfo");
@@ -492,6 +498,12 @@ TEST_F(SerialApiTest, Update) {
EXPECT_EQ(11u, io_handler_->num_calls());
}
+TEST_F(SerialApiTest, UpdateAcrossSerialization) {
+ io_handler_ = new ConfigurePortTestIoHandler;
+ RunTest("serial_unittest.js", "testUpdateAcrossSerialization");
+ EXPECT_EQ(11u, io_handler_->num_calls());
+}
+
TEST_F(SerialApiTest, UpdateInvalidBitrate) {
io_handler_ = new ConfigurePortTestIoHandler;
RunTest("serial_unittest.js", "testUpdateInvalidBitrate");
@@ -512,6 +524,10 @@ TEST_F(SerialApiTest, Echo) {
RunTest("serial_unittest.js", "testEcho");
}
+TEST_F(SerialApiTest, EchoAfterSerialization) {
+ RunTest("serial_unittest.js", "testEchoAfterSerialization");
+}
+
TEST_F(SerialApiTest, SendDuringExistingSend) {
RunTest("serial_unittest.js", "testSendDuringExistingSend");
}
@@ -530,6 +546,11 @@ TEST_F(SerialApiTest, SendTimeout) {
RunTest("serial_unittest.js", "testSendTimeout");
}
+TEST_F(SerialApiTest, SendTimeoutAfterSerialization) {
+ io_handler_ = new BlockSendsForeverSendIoHandler();
+ RunTest("serial_unittest.js", "testSendTimeoutAfterSerialization");
+}
+
TEST_F(SerialApiTest, DisableSendTimeout) {
io_handler_ = new BlockSendsForeverSendIoHandler();
RunTest("serial_unittest.js", "testDisableSendTimeout");
@@ -550,6 +571,10 @@ TEST_F(SerialApiTest, ReceiveTimeout) {
RunTest("serial_unittest.js", "testReceiveTimeout");
}
+TEST_F(SerialApiTest, ReceiveTimeoutAfterSerialization) {
+ RunTest("serial_unittest.js", "testReceiveTimeoutAfterSerialization");
+}
+
TEST_F(SerialApiTest, DisableReceiveTimeout) {
RunTest("serial_unittest.js", "testDisableReceiveTimeout");
}