Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: media/base/buffers_unittest.cc

Issue 9854031: Replace size_t with int in a few media classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/buffers.h ('k') | media/base/data_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/string_util.h" 5 #include "base/string_util.h"
6 #include "media/base/buffers.h" 6 #include "media/base/buffers.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace media { 9 namespace media {
10 10
11 namespace { 11 namespace {
12 12
13 // Simple implementation of Buffer to test base class functionality. 13 // Simple implementation of Buffer to test base class functionality.
14 class TestBuffer : public Buffer { 14 class TestBuffer : public Buffer {
15 public: 15 public:
16 TestBuffer() 16 TestBuffer()
17 : Buffer(base::TimeDelta(), base::TimeDelta()) { 17 : Buffer(base::TimeDelta(), base::TimeDelta()) {
18 } 18 }
19 19
20 // Sets |data_| and |size_| members for testing purposes. Does not take 20 // Sets |data_| and |size_| members for testing purposes. Does not take
21 // ownership of |data|. 21 // ownership of |data|.
22 TestBuffer(const uint8* data, size_t size) 22 TestBuffer(const uint8* data, int size)
23 : Buffer(base::TimeDelta(), base::TimeDelta()), 23 : Buffer(base::TimeDelta(), base::TimeDelta()),
24 data_(data), 24 data_(data),
25 size_(size) { 25 size_(size) {
26 } 26 }
27 27
28 virtual ~TestBuffer() {} 28 virtual ~TestBuffer() {}
29 29
30 // Buffer implementation. 30 // Buffer implementation.
31 virtual const uint8* GetData() const OVERRIDE { return data_; } 31 virtual const uint8* GetData() const OVERRIDE { return data_; }
32 virtual size_t GetDataSize() const OVERRIDE { return size_; } 32 virtual int GetDataSize() const OVERRIDE { return size_; }
33 33
34 private: 34 private:
35 const uint8* data_; 35 const uint8* data_;
36 size_t size_; 36 int size_;
37 37
38 DISALLOW_COPY_AND_ASSIGN(TestBuffer); 38 DISALLOW_COPY_AND_ASSIGN(TestBuffer);
39 }; 39 };
40 40
41 } // namespace 41 } // namespace
42 42
43 TEST(BufferTest, Timestamp) { 43 TEST(BufferTest, Timestamp) {
44 const base::TimeDelta kZero; 44 const base::TimeDelta kZero;
45 const base::TimeDelta kTimestampA = base::TimeDelta::FromMicroseconds(1337); 45 const base::TimeDelta kTimestampA = base::TimeDelta::FromMicroseconds(1337);
46 const base::TimeDelta kTimestampB = base::TimeDelta::FromMicroseconds(1234); 46 const base::TimeDelta kTimestampB = base::TimeDelta::FromMicroseconds(1234);
(...skipping 18 matching lines...) Expand all
65 65
66 buffer->SetDuration(kDurationA); 66 buffer->SetDuration(kDurationA);
67 EXPECT_TRUE(buffer->GetDuration() == kDurationA); 67 EXPECT_TRUE(buffer->GetDuration() == kDurationA);
68 68
69 buffer->SetDuration(kDurationB); 69 buffer->SetDuration(kDurationB);
70 EXPECT_TRUE(buffer->GetDuration() == kDurationB); 70 EXPECT_TRUE(buffer->GetDuration() == kDurationB);
71 } 71 }
72 72
73 TEST(BufferTest, IsEndOfStream) { 73 TEST(BufferTest, IsEndOfStream) {
74 const uint8 kData[] = { 0x00, 0xFF }; 74 const uint8 kData[] = { 0x00, 0xFF };
75 const size_t kDataSize = arraysize(kData); 75 const int kDataSize = arraysize(kData);
76 76
77 scoped_refptr<TestBuffer> buffer = new TestBuffer(NULL, 0); 77 scoped_refptr<TestBuffer> buffer = new TestBuffer(NULL, 0);
78 EXPECT_TRUE(buffer->IsEndOfStream()); 78 EXPECT_TRUE(buffer->IsEndOfStream());
79 79
80 buffer = new TestBuffer(kData, kDataSize); 80 buffer = new TestBuffer(kData, kDataSize);
81 EXPECT_FALSE(buffer->IsEndOfStream()); 81 EXPECT_FALSE(buffer->IsEndOfStream());
82 } 82 }
83 83
84 TEST(BufferTest, GetDecryptConfig) { 84 TEST(BufferTest, GetDecryptConfig) {
85 scoped_refptr<TestBuffer> buffer = new TestBuffer(); 85 scoped_refptr<TestBuffer> buffer = new TestBuffer();
86 EXPECT_FALSE(buffer->GetDecryptConfig()); 86 EXPECT_FALSE(buffer->GetDecryptConfig());
87 } 87 }
88 88
89 } // namespace media 89 } // namespace media
OLDNEW
« no previous file with comments | « media/base/buffers.h ('k') | media/base/data_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698