| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Note that, the IPC part is not utilized in this test. | 81 // Note that, the IPC part is not utilized in this test. |
| 82 content::GetContentClient()->set_renderer(&mock_content_renderer_client_); | 82 content::GetContentClient()->set_renderer(&mock_content_renderer_client_); |
| 83 | 83 |
| 84 static const char kThreadName[] = "RenderThread"; | 84 static const char kThreadName[] = "RenderThread"; |
| 85 channel_.reset(new IPC::Channel(kThreadName, | 85 channel_.reset(new IPC::Channel(kThreadName, |
| 86 IPC::Channel::MODE_SERVER, this)); | 86 IPC::Channel::MODE_SERVER, this)); |
| 87 ASSERT_TRUE(channel_->Connect()); | 87 ASSERT_TRUE(channel_->Connect()); |
| 88 | 88 |
| 89 mock_process_.reset(new MockRenderProcess); | 89 mock_process_.reset(new MockRenderProcess); |
| 90 render_thread_ = new RenderThreadImpl(kThreadName); | 90 render_thread_ = new RenderThreadImpl(kThreadName); |
| 91 mock_process_->set_main_thread(render_thread_); | |
| 92 | 91 |
| 93 // Setup expectations for initialization. | 92 // Setup expectations for initialization. |
| 94 decoder_ = new media::MockAudioDecoder(); | 93 decoder_ = new media::MockAudioDecoder(); |
| 95 | 94 |
| 96 EXPECT_CALL(*decoder_, bits_per_channel()) | 95 EXPECT_CALL(*decoder_, bits_per_channel()) |
| 97 .WillRepeatedly(Return(16)); | 96 .WillRepeatedly(Return(16)); |
| 98 EXPECT_CALL(*decoder_, channel_layout()) | 97 EXPECT_CALL(*decoder_, channel_layout()) |
| 99 .WillRepeatedly(Return(CHANNEL_LAYOUT_MONO)); | 98 .WillRepeatedly(Return(CHANNEL_LAYOUT_MONO)); |
| 100 EXPECT_CALL(*decoder_, samples_per_second()) | 99 EXPECT_CALL(*decoder_, samples_per_second()) |
| 101 .WillRepeatedly(Return(44100)); | 100 .WillRepeatedly(Return(44100)); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 base::Time time_now = base::Time(); // Null time by default. | 177 base::Time time_now = base::Time(); // Null time by default. |
| 179 renderer_->set_earliest_end_time(time_now); | 178 renderer_->set_earliest_end_time(time_now); |
| 180 renderer_->UpdateEarliestEndTime(renderer_->bytes_per_second(), | 179 renderer_->UpdateEarliestEndTime(renderer_->bytes_per_second(), |
| 181 base::TimeDelta::FromMilliseconds(100), | 180 base::TimeDelta::FromMilliseconds(100), |
| 182 time_now); | 181 time_now); |
| 183 int time_delta = (renderer_->earliest_end_time() - time_now).InMilliseconds(); | 182 int time_delta = (renderer_->earliest_end_time() - time_now).InMilliseconds(); |
| 184 EXPECT_EQ(1100, time_delta); | 183 EXPECT_EQ(1100, time_delta); |
| 185 renderer_->Stop(media::NewExpectedClosure()); | 184 renderer_->Stop(media::NewExpectedClosure()); |
| 186 WaitForIOThreadCompletion(); | 185 WaitForIOThreadCompletion(); |
| 187 } | 186 } |
| OLD | NEW |