OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdint.h> | 5 #include <stdint.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "device/serial/buffer.h" | 13 #include "device/serial/buffer.h" |
14 #include "device/serial/data_receiver.h" | 14 #include "device/serial/data_receiver.h" |
15 #include "device/serial/data_source_sender.h" | 15 #include "device/serial/data_source_sender.h" |
16 #include "device/serial/data_stream.mojom.h" | 16 #include "device/serial/data_stream.mojom.h" |
17 #include "mojo/public/cpp/bindings/interface_ptr.h" | 17 #include "mojo/public/cpp/bindings/interface_ptr.h" |
18 #include "mojo/public/cpp/environment/async_waiter.h" | |
19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
20 | 19 |
21 namespace device { | 20 namespace device { |
22 | 21 |
23 class DataSourceTest : public testing::Test { | 22 class DataSourceTest : public testing::Test { |
24 public: | 23 public: |
25 enum Event { | 24 enum Event { |
26 EVENT_NONE, | 25 EVENT_NONE, |
27 EVENT_WRITE_BUFFER_READY, | 26 EVENT_WRITE_BUFFER_READY, |
28 EVENT_RECEIVE_COMPLETE, | 27 EVENT_RECEIVE_COMPLETE, |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // Test that the receiver shutting down is correctly reported to the source. | 252 // Test that the receiver shutting down is correctly reported to the source. |
254 TEST_F(DataSourceTest, ReceiverShutdown) { | 253 TEST_F(DataSourceTest, ReceiverShutdown) { |
255 Receive(); | 254 Receive(); |
256 receiver_ = NULL; | 255 receiver_ = NULL; |
257 EXPECT_EQ(kFatalError, error_); | 256 EXPECT_EQ(kFatalError, error_); |
258 WaitForEvent(EVENT_ERROR); | 257 WaitForEvent(EVENT_ERROR); |
259 EXPECT_TRUE(seen_connection_error_); | 258 EXPECT_TRUE(seen_connection_error_); |
260 } | 259 } |
261 | 260 |
262 } // namespace device | 261 } // namespace device |
OLD | NEW |