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 <tuple> |
| 6 |
5 #include "base/macros.h" | 7 #include "base/macros.h" |
6 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
7 #include "base/test/test_mock_time_task_runner.h" | 9 #include "base/test/test_mock_time_task_runner.h" |
8 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
9 #include "content/public/test/mock_render_thread.h" | 11 #include "content/public/test/mock_render_thread.h" |
10 #include "content/renderer/media/render_media_log.h" | 12 #include "content/renderer/media/render_media_log.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
12 | 14 |
13 namespace content { | 15 namespace content { |
14 | 16 |
(...skipping 25 matching lines...) Expand all Loading... |
40 int message_count() { return render_thread_.sink().message_count(); } | 42 int message_count() { return render_thread_.sink().message_count(); } |
41 | 43 |
42 std::vector<media::MediaLogEvent> GetMediaLogEvents() { | 44 std::vector<media::MediaLogEvent> GetMediaLogEvents() { |
43 const IPC::Message* msg = render_thread_.sink().GetFirstMessageMatching( | 45 const IPC::Message* msg = render_thread_.sink().GetFirstMessageMatching( |
44 ViewHostMsg_MediaLogEvents::ID); | 46 ViewHostMsg_MediaLogEvents::ID); |
45 if (!msg) { | 47 if (!msg) { |
46 ADD_FAILURE() << "Did not find ViewHostMsg_MediaLogEvents IPC message"; | 48 ADD_FAILURE() << "Did not find ViewHostMsg_MediaLogEvents IPC message"; |
47 return std::vector<media::MediaLogEvent>(); | 49 return std::vector<media::MediaLogEvent>(); |
48 } | 50 } |
49 | 51 |
50 base::Tuple<std::vector<media::MediaLogEvent>> events; | 52 std::tuple<std::vector<media::MediaLogEvent>> events; |
51 ViewHostMsg_MediaLogEvents::Read(msg, &events); | 53 ViewHostMsg_MediaLogEvents::Read(msg, &events); |
52 return base::get<0>(events); | 54 return std::get<0>(events); |
53 } | 55 } |
54 | 56 |
55 private: | 57 private: |
56 base::MessageLoop message_loop_; | 58 base::MessageLoop message_loop_; |
57 MockRenderThread render_thread_; | 59 MockRenderThread render_thread_; |
58 scoped_refptr<RenderMediaLog> log_; | 60 scoped_refptr<RenderMediaLog> log_; |
59 base::SimpleTestTickClock* tick_clock_; // Owned by |log_|. | 61 base::SimpleTestTickClock* tick_clock_; // Owned by |log_|. |
60 scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; | 62 scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; |
61 | 63 |
62 DISALLOW_COPY_AND_ASSIGN(RenderMediaLogTest); | 64 DISALLOW_COPY_AND_ASSIGN(RenderMediaLogTest); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // Verify contents. There should only be a single buffered extents changed | 117 // Verify contents. There should only be a single buffered extents changed |
116 // event. | 118 // event. |
117 std::vector<media::MediaLogEvent> events = GetMediaLogEvents(); | 119 std::vector<media::MediaLogEvent> events = GetMediaLogEvents(); |
118 ASSERT_EQ(3u, events.size()); | 120 ASSERT_EQ(3u, events.size()); |
119 EXPECT_EQ(media::MediaLogEvent::LOAD, events[0].type); | 121 EXPECT_EQ(media::MediaLogEvent::LOAD, events[0].type); |
120 EXPECT_EQ(media::MediaLogEvent::SEEK, events[1].type); | 122 EXPECT_EQ(media::MediaLogEvent::SEEK, events[1].type); |
121 EXPECT_EQ(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED, events[2].type); | 123 EXPECT_EQ(media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED, events[2].type); |
122 } | 124 } |
123 | 125 |
124 } // namespace content | 126 } // namespace content |
OLD | NEW |