OLD | NEW |
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 "content/common/view_messages.h" | 6 #include "content/common/view_messages.h" |
7 #include "content/public/test/mock_render_thread.h" | 7 #include "content/public/test/mock_render_thread.h" |
8 #include "content/renderer/media/render_media_log.h" | 8 #include "content/renderer/media/render_media_log.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 int message_count() { return render_thread_.sink().message_count(); } | 29 int message_count() { return render_thread_.sink().message_count(); } |
30 | 30 |
31 std::vector<media::MediaLogEvent> GetMediaLogEvents() { | 31 std::vector<media::MediaLogEvent> GetMediaLogEvents() { |
32 const IPC::Message* msg = render_thread_.sink().GetFirstMessageMatching( | 32 const IPC::Message* msg = render_thread_.sink().GetFirstMessageMatching( |
33 ViewHostMsg_MediaLogEvents::ID); | 33 ViewHostMsg_MediaLogEvents::ID); |
34 if (!msg) { | 34 if (!msg) { |
35 ADD_FAILURE() << "Did not find ViewHostMsg_MediaLogEvents IPC message"; | 35 ADD_FAILURE() << "Did not find ViewHostMsg_MediaLogEvents IPC message"; |
36 return std::vector<media::MediaLogEvent>(); | 36 return std::vector<media::MediaLogEvent>(); |
37 } | 37 } |
38 | 38 |
39 Tuple1<std::vector<media::MediaLogEvent> > events; | 39 Tuple<std::vector<media::MediaLogEvent>> events; |
40 ViewHostMsg_MediaLogEvents::Read(msg, &events); | 40 ViewHostMsg_MediaLogEvents::Read(msg, &events); |
41 return events.a; | 41 return get<0>(events); |
42 } | 42 } |
43 | 43 |
44 private: | 44 private: |
45 MockRenderThread render_thread_; | 45 MockRenderThread render_thread_; |
46 scoped_refptr<RenderMediaLog> log_; | 46 scoped_refptr<RenderMediaLog> log_; |
47 base::SimpleTestTickClock* tick_clock_; // Owned by |log_|. | 47 base::SimpleTestTickClock* tick_clock_; // Owned by |log_|. |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(RenderMediaLogTest); | 49 DISALLOW_COPY_AND_ASSIGN(RenderMediaLogTest); |
50 }; | 50 }; |
51 | 51 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // event. | 95 // event. |
96 std::vector<media::MediaLogEvent> events = GetMediaLogEvents(); | 96 std::vector<media::MediaLogEvent> events = GetMediaLogEvents(); |
97 ASSERT_EQ(4u, events.size()); | 97 ASSERT_EQ(4u, events.size()); |
98 EXPECT_EQ(media::MediaLogEvent::LOAD, events[0].type); | 98 EXPECT_EQ(media::MediaLogEvent::LOAD, events[0].type); |
99 EXPECT_EQ(media::MediaLogEvent::SEEK, events[1].type); | 99 EXPECT_EQ(media::MediaLogEvent::SEEK, events[1].type); |
100 EXPECT_EQ(media::MediaLogEvent::PLAY, events[2].type); | 100 EXPECT_EQ(media::MediaLogEvent::PLAY, events[2].type); |
101 EXPECT_EQ(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED, events[3].type); | 101 EXPECT_EQ(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED, events[3].type); |
102 } | 102 } |
103 | 103 |
104 } // namespace content | 104 } // namespace content |
OLD | NEW |