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

Side by Side Diff: media/webm/webm_cluster_parser_unittest.cc

Issue 11471006: Log MediaSource parsing errors to the MediaLog so they can appear in chrome:media-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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
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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/bind.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "media/webm/cluster_builder.h" 9 #include "media/webm/cluster_builder.h"
9 #include "media/webm/webm_cluster_parser.h" 10 #include "media/webm/webm_cluster_parser.h"
10 #include "media/webm/webm_constants.h" 11 #include "media/webm/webm_constants.h"
11 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 using ::testing::InSequence; 15 using ::testing::InSequence;
15 using ::testing::Return; 16 using ::testing::Return;
16 using ::testing::_; 17 using ::testing::_;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 WebMClusterParser::BufferQueue* dest) { 118 WebMClusterParser::BufferQueue* dest) {
118 for (WebMClusterParser::BufferQueue::const_iterator itr = src.begin(); 119 for (WebMClusterParser::BufferQueue::const_iterator itr = src.begin();
119 itr != src.end(); ++itr) { 120 itr != src.end(); ++itr) {
120 dest->push_back(*itr); 121 dest->push_back(*itr);
121 } 122 }
122 } 123 }
123 124
124 class WebMClusterParserTest : public testing::Test { 125 class WebMClusterParserTest : public testing::Test {
125 public: 126 public:
126 WebMClusterParserTest() 127 WebMClusterParserTest()
127 : parser_(new WebMClusterParser(kTimecodeScale, 128 : parser_(new WebMClusterParser(
128 kAudioTrackNum, kVideoTrackNum, 129 kTimecodeScale, kAudioTrackNum, kVideoTrackNum, "", "",
129 "", "")) { 130 ErrorLogCB())) {
130 } 131 }
131 132
132 protected: 133 protected:
133 scoped_ptr<WebMClusterParser> parser_; 134 scoped_ptr<WebMClusterParser> parser_;
134 }; 135 };
135 136
136 TEST_F(WebMClusterParserTest, TestReset) { 137 TEST_F(WebMClusterParserTest, TestReset) {
137 InSequence s; 138 InSequence s;
138 139
139 int block_count = arraysize(kDefaultBlockInfo); 140 int block_count = arraysize(kDefaultBlockInfo);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 }; 241 };
241 int block_count = arraysize(kBlockInfo); 242 int block_count = arraysize(kBlockInfo);
242 scoped_ptr<Cluster> cluster(CreateCluster(0, kBlockInfo, block_count)); 243 scoped_ptr<Cluster> cluster(CreateCluster(0, kBlockInfo, block_count));
243 244
244 int result = parser_->Parse(cluster->data(), cluster->size()); 245 int result = parser_->Parse(cluster->data(), cluster->size());
245 EXPECT_EQ(cluster->size(), result); 246 EXPECT_EQ(cluster->size(), result);
246 ASSERT_TRUE(VerifyBuffers(parser_, kBlockInfo, block_count)); 247 ASSERT_TRUE(VerifyBuffers(parser_, kBlockInfo, block_count));
247 } 248 }
248 249
249 } // namespace media 250 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698