| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/tests/test_transport.h" | 5 #include "ppapi/tests/test_transport.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 return result; \ | 27 return result; \ |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 const char kTestChannelName[] = "test"; | 32 const char kTestChannelName[] = "test"; |
| 33 const int kReadBufferSize = 65536; | 33 const int kReadBufferSize = 65536; |
| 34 | 34 |
| 35 class StreamReader { | 35 class StreamReader { |
| 36 public: | 36 public: |
| 37 explicit StreamReader(pp::Transport_Dev* transport, | 37 StreamReader(pp::Transport_Dev* transport, |
| 38 int expected_size, | 38 int expected_size, |
| 39 pp::CompletionCallback done_callback) | 39 pp::CompletionCallback done_callback) |
| 40 : expected_size_(expected_size), | 40 : expected_size_(expected_size), |
| 41 done_callback_(done_callback), | 41 done_callback_(done_callback), |
| 42 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)), | 42 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)), |
| 43 transport_(transport), | 43 transport_(transport), |
| 44 received_size_(0) { | 44 received_size_(0) { |
| 45 Read(); | 45 Read(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 const std::list<std::vector<char> >& received() { return received_; } | 48 const std::list<std::vector<char> >& received() { return received_; } |
| 49 std::list<std::string> errors() { return errors_; } | 49 std::list<std::string> errors() { return errors_; } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // Close the transport and verify that callback is aborted. | 311 // Close the transport and verify that callback is aborted. |
| 312 ASSERT_EQ(transport1_->Close(), PP_OK); | 312 ASSERT_EQ(transport1_->Close(), PP_OK); |
| 313 | 313 |
| 314 ASSERT_EQ(recv_cb.run_count(), 1); | 314 ASSERT_EQ(recv_cb.run_count(), 1); |
| 315 ASSERT_EQ(recv_cb.result(), PP_ERROR_ABORTED); | 315 ASSERT_EQ(recv_cb.result(), PP_ERROR_ABORTED); |
| 316 | 316 |
| 317 Clean(); | 317 Clean(); |
| 318 | 318 |
| 319 PASS(); | 319 PASS(); |
| 320 } | 320 } |
| OLD | NEW |