| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "content/browser/speech/chunked_byte_buffer.h" | 10 #include "content/browser/speech/chunked_byte_buffer.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 buffer.Append(kChunks + 2, 6); | 35 buffer.Append(kChunks + 2, 6); |
| 36 EXPECT_EQ(8U, buffer.GetTotalLength()); | 36 EXPECT_EQ(8U, buffer.GetTotalLength()); |
| 37 EXPECT_TRUE(buffer.HasChunks()); | 37 EXPECT_TRUE(buffer.HasChunks()); |
| 38 | 38 |
| 39 // Append fully chunk 2. | 39 // Append fully chunk 2. |
| 40 buffer.Append(kChunks + 8, 6); | 40 buffer.Append(kChunks + 8, 6); |
| 41 EXPECT_EQ(14U, buffer.GetTotalLength()); | 41 EXPECT_EQ(14U, buffer.GetTotalLength()); |
| 42 EXPECT_TRUE(buffer.HasChunks()); | 42 EXPECT_TRUE(buffer.HasChunks()); |
| 43 | 43 |
| 44 // Remove and check chunk 1. | 44 // Remove and check chunk 1. |
| 45 scoped_ptr<ByteVector> chunk; | 45 std::unique_ptr<ByteVector> chunk; |
| 46 chunk = buffer.PopChunk(); | 46 chunk = buffer.PopChunk(); |
| 47 EXPECT_TRUE(chunk != NULL); | 47 EXPECT_TRUE(chunk != NULL); |
| 48 EXPECT_EQ(4U, chunk->size()); | 48 EXPECT_EQ(4U, chunk->size()); |
| 49 EXPECT_EQ(0, std::char_traits<uint8_t>::compare(kChunks + 4, &(*chunk)[0], | 49 EXPECT_EQ(0, std::char_traits<uint8_t>::compare(kChunks + 4, &(*chunk)[0], |
| 50 chunk->size())); | 50 chunk->size())); |
| 51 EXPECT_EQ(6U, buffer.GetTotalLength()); | 51 EXPECT_EQ(6U, buffer.GetTotalLength()); |
| 52 EXPECT_TRUE(buffer.HasChunks()); | 52 EXPECT_TRUE(buffer.HasChunks()); |
| 53 | 53 |
| 54 // Read and check chunk 2. | 54 // Read and check chunk 2. |
| 55 chunk = buffer.PopChunk(); | 55 chunk = buffer.PopChunk(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 67 // Remove and check chunk 3. | 67 // Remove and check chunk 3. |
| 68 chunk = buffer.PopChunk(); | 68 chunk = buffer.PopChunk(); |
| 69 EXPECT_TRUE(chunk != NULL); | 69 EXPECT_TRUE(chunk != NULL); |
| 70 EXPECT_EQ(1U, chunk->size()); | 70 EXPECT_EQ(1U, chunk->size()); |
| 71 EXPECT_EQ((*chunk)[0], kChunks[18]); | 71 EXPECT_EQ((*chunk)[0], kChunks[18]); |
| 72 EXPECT_EQ(0U, buffer.GetTotalLength()); | 72 EXPECT_EQ(0U, buffer.GetTotalLength()); |
| 73 EXPECT_FALSE(buffer.HasChunks()); | 73 EXPECT_FALSE(buffer.HasChunks()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace content | 76 } // namespace content |
| OLD | NEW |