summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/api
diff options
context:
space:
mode:
authorsammc <sammc@chromium.org>2014-10-04 01:35:45 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-04 08:35:59 +0000
commit8ef8db1b7662d904fc3c325422aa8c58e1533e52 (patch)
treefb39ffc0dee7254f0a5a062b22d23bd60914939c /extensions/renderer/api
parentb373ec3d9f757ba065bae01de186632ff0f260d3 (diff)
downloadchromium_src-8ef8db1b7662d904fc3c325422aa8c58e1533e52.zip
chromium_src-8ef8db1b7662d904fc3c325422aa8c58e1533e52.tar.gz
chromium_src-8ef8db1b7662d904fc3c325422aa8c58e1533e52.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 Committed: https://crrev.com/3daad1ed89cd32023624be98edaf051a0043ff5f Cr-Commit-Position: refs/heads/master@{#298158} Review URL: https://codereview.chromium.org/592263004 Cr-Commit-Position: refs/heads/master@{#298171}
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");
}