| 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/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 static const char kThreadName[] = "RenderThread"; | 143 static const char kThreadName[] = "RenderThread"; |
| 144 channel_.reset(new IPC::Channel(kThreadName, | 144 channel_.reset(new IPC::Channel(kThreadName, |
| 145 IPC::Channel::MODE_SERVER, this)); | 145 IPC::Channel::MODE_SERVER, this)); |
| 146 ASSERT_TRUE(channel_->Connect()); | 146 ASSERT_TRUE(channel_->Connect()); |
| 147 | 147 |
| 148 mock_process_.reset(new MockRenderProcess); | 148 mock_process_.reset(new MockRenderProcess); |
| 149 render_thread_ = new RenderThreadImpl(kThreadName); | 149 render_thread_ = new RenderThreadImpl(kThreadName); |
| 150 mock_process_->set_main_thread(render_thread_); | 150 mock_process_->set_main_thread(render_thread_); |
| 151 | 151 |
| 152 // Create temporary shared memory. | 152 // Create temporary shared memory. |
| 153 CHECK(shared_mem_.CreateAnonymous(kSize)); | 153 CHECK(shared_mem_.CreateAnonymous(kSize, false)); |
| 154 | 154 |
| 155 // Setup expectations for initialization. | 155 // Setup expectations for initialization. |
| 156 decoder_ = new media::MockAudioDecoder(); | 156 decoder_ = new media::MockAudioDecoder(); |
| 157 | 157 |
| 158 EXPECT_CALL(*decoder_, bits_per_channel()) | 158 EXPECT_CALL(*decoder_, bits_per_channel()) |
| 159 .WillRepeatedly(Return(16)); | 159 .WillRepeatedly(Return(16)); |
| 160 EXPECT_CALL(*decoder_, channel_layout()) | 160 EXPECT_CALL(*decoder_, channel_layout()) |
| 161 .WillRepeatedly(Return(CHANNEL_LAYOUT_MONO)); | 161 .WillRepeatedly(Return(CHANNEL_LAYOUT_MONO)); |
| 162 EXPECT_CALL(*decoder_, samples_per_second()) | 162 EXPECT_CALL(*decoder_, samples_per_second()) |
| 163 .WillRepeatedly(Return(44100)); | 163 .WillRepeatedly(Return(44100)); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 base::Time time_now = base::Time(); // Null time by default. | 348 base::Time time_now = base::Time(); // Null time by default. |
| 349 renderer_->set_earliest_end_time(time_now); | 349 renderer_->set_earliest_end_time(time_now); |
| 350 renderer_->UpdateEarliestEndTime(renderer_->bytes_per_second(), | 350 renderer_->UpdateEarliestEndTime(renderer_->bytes_per_second(), |
| 351 base::TimeDelta::FromMilliseconds(100), | 351 base::TimeDelta::FromMilliseconds(100), |
| 352 time_now); | 352 time_now); |
| 353 int time_delta = (renderer_->earliest_end_time() - time_now).InMilliseconds(); | 353 int time_delta = (renderer_->earliest_end_time() - time_now).InMilliseconds(); |
| 354 EXPECT_EQ(1100, time_delta); | 354 EXPECT_EQ(1100, time_delta); |
| 355 renderer_->Stop(media::NewExpectedClosure()); | 355 renderer_->Stop(media::NewExpectedClosure()); |
| 356 WaitForIOThreadCompletion(); | 356 WaitForIOThreadCompletion(); |
| 357 } | 357 } |
| OLD | NEW |