| 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 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 data = data_to_send_.front(); | 109 data = data_to_send_.front(); |
| 110 data_to_send_.pop(); | 110 data_to_send_.pop(); |
| 111 } | 111 } |
| 112 if (!error_to_send_.empty()) { | 112 if (!error_to_send_.empty()) { |
| 113 error = error_to_send_.front(); | 113 error = error_to_send_.front(); |
| 114 error_to_send_.pop(); | 114 error_to_send_.pop(); |
| 115 } | 115 } |
| 116 DCHECK(buffer->GetSize() >= static_cast<uint32_t>(data.size())); | 116 DCHECK(buffer->GetSize() >= static_cast<uint32_t>(data.size())); |
| 117 memcpy(buffer->GetData(), data.c_str(), data.size()); | 117 memcpy(buffer->GetData(), data.c_str(), data.size()); |
| 118 if (error) | 118 if (error) |
| 119 buffer->DoneWithError(data.size(), error); | 119 buffer->DoneWithError(static_cast<uint32_t>(data.size()), error); |
| 120 else | 120 else |
| 121 buffer->Done(data.size()); | 121 buffer->Done(static_cast<uint32_t>(data.size())); |
| 122 } | 122 } |
| 123 | 123 |
| 124 scoped_refptr<device::DataSourceSender> sender_; | 124 scoped_refptr<device::DataSourceSender> sender_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(DataReceiverTest); | 126 DISALLOW_COPY_AND_ASSIGN(DataReceiverTest); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 // https://crbug.com/599898 | 129 // https://crbug.com/599898 |
| 130 #if defined(LEAK_SANITIZER) | 130 #if defined(LEAK_SANITIZER) |
| 131 #define MAYBE_Receive DISABLED_Receive | 131 #define MAYBE_Receive DISABLED_Receive |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 #define MAYBE_SerializeAfterClose DISABLED_SerializeAfterClose | 193 #define MAYBE_SerializeAfterClose DISABLED_SerializeAfterClose |
| 194 #else | 194 #else |
| 195 #define MAYBE_SerializeAfterClose SerializeAfterClose | 195 #define MAYBE_SerializeAfterClose SerializeAfterClose |
| 196 #endif | 196 #endif |
| 197 TEST_F(DataReceiverTest, MAYBE_SerializeAfterClose) { | 197 TEST_F(DataReceiverTest, MAYBE_SerializeAfterClose) { |
| 198 data_to_send_.push("a"); | 198 data_to_send_.push("a"); |
| 199 RunTest("data_receiver_unittest.js", "testSerializeAfterClose"); | 199 RunTest("data_receiver_unittest.js", "testSerializeAfterClose"); |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace extensions | 202 } // namespace extensions |
| OLD | NEW |