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

Side by Side Diff: content/renderer/media/render_media_log_unittest.cc

Issue 1236543007: MSE: Log buffered audio splice generation to media-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/test/simple_test_tick_clock.h" 5 #include "base/test/simple_test_tick_clock.h"
6 #include "base/test/test_mock_time_task_runner.h" 6 #include "base/test/test_mock_time_task_runner.h"
7 #include "content/common/view_messages.h" 7 #include "content/common/view_messages.h"
8 #include "content/public/test/mock_render_thread.h" 8 #include "content/public/test/mock_render_thread.h"
9 #include "content/renderer/media/render_media_log.h" 9 #include "content/renderer/media/render_media_log.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // right away. 94 // right away.
95 Advance(base::TimeDelta::FromMilliseconds(2000)); 95 Advance(base::TimeDelta::FromMilliseconds(2000));
96 AddEvent(media::MediaLogEvent::LOAD); 96 AddEvent(media::MediaLogEvent::LOAD);
97 EXPECT_EQ(2, message_count()); 97 EXPECT_EQ(2, message_count());
98 } 98 }
99 99
100 TEST_F(RenderMediaLogTest, BufferedExtents) { 100 TEST_F(RenderMediaLogTest, BufferedExtents) {
101 AddEvent(media::MediaLogEvent::LOAD); 101 AddEvent(media::MediaLogEvent::LOAD);
102 AddEvent(media::MediaLogEvent::SEEK); 102 AddEvent(media::MediaLogEvent::SEEK);
103 103
104 // This event is handled separately and should always appear last regardless 104 // This event is handled separately and should always appear last (or next to
105 // of how many times we see it. 105 // last, if we have an audio splice statistics update, too) regardless of how
106 // many times we see it.
106 AddEvent(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED); 107 AddEvent(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED);
107 AddEvent(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED); 108 AddEvent(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED);
108 AddEvent(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED); 109 AddEvent(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED);
109 110
110 EXPECT_EQ(0, message_count()); 111 EXPECT_EQ(0, message_count());
111 Advance(base::TimeDelta::FromMilliseconds(1000)); 112 Advance(base::TimeDelta::FromMilliseconds(1000));
112 EXPECT_EQ(1, message_count()); 113 EXPECT_EQ(1, message_count());
113 114
114 // Verify contents. There should only be a single buffered extents changed 115 // Verify contents. There should only be a single buffered extents changed
115 // event. 116 // event.
116 std::vector<media::MediaLogEvent> events = GetMediaLogEvents(); 117 std::vector<media::MediaLogEvent> events = GetMediaLogEvents();
117 ASSERT_EQ(3u, events.size()); 118 ASSERT_EQ(3u, events.size());
118 EXPECT_EQ(media::MediaLogEvent::LOAD, events[0].type); 119 EXPECT_EQ(media::MediaLogEvent::LOAD, events[0].type);
119 EXPECT_EQ(media::MediaLogEvent::SEEK, events[1].type); 120 EXPECT_EQ(media::MediaLogEvent::SEEK, events[1].type);
120 EXPECT_EQ(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED, events[2].type); 121 EXPECT_EQ(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED, events[2].type);
121 } 122 }
122 123
124 TEST_F(RenderMediaLogTest, BufferedAudioSpliceStatistics) {
125 AddEvent(media::MediaLogEvent::LOAD);
126 AddEvent(media::MediaLogEvent::SEEK);
127
128 // This event is handled separately and should always appear last regardless
129 // of how many times we see it.
130 AddEvent(media::MediaLogEvent::BUFFERED_AUDIO_SPLICE_STATISTICS_CHANGED);
131 AddEvent(media::MediaLogEvent::BUFFERED_AUDIO_SPLICE_STATISTICS_CHANGED);
132 AddEvent(media::MediaLogEvent::BUFFERED_AUDIO_SPLICE_STATISTICS_CHANGED);
133
134 EXPECT_EQ(0, message_count());
135 Advance(base::TimeDelta::FromMilliseconds(1000));
136 EXPECT_EQ(1, message_count());
137
138 // Verify contents. There should only be a single buffered audio splice
139 // statistics changed event.
140 std::vector<media::MediaLogEvent> events = GetMediaLogEvents();
141 ASSERT_EQ(3u, events.size());
142 EXPECT_EQ(media::MediaLogEvent::LOAD, events[0].type);
143 EXPECT_EQ(media::MediaLogEvent::SEEK, events[1].type);
144 EXPECT_EQ(media::MediaLogEvent::BUFFERED_AUDIO_SPLICE_STATISTICS_CHANGED,
145 events[2].type);
146 }
147
123 } // namespace content 148 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698