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

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

Issue 9297022: Change ChildProcess::set_main_thread registration to occur inside the RenderThreadImpl::Init method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Main parts are inspired by the RenderViewFakeResourcesTest. 80 // Main parts are inspired by the RenderViewFakeResourcesTest.
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 // The RenderThreadImpl will register itself as the main thread for the
91 // current process.
90 render_thread_ = new RenderThreadImpl(kThreadName); 92 render_thread_ = new RenderThreadImpl(kThreadName);
91 mock_process_->set_main_thread(render_thread_);
92 93
93 // Setup expectations for initialization. 94 // Setup expectations for initialization.
94 decoder_ = new media::MockAudioDecoder(); 95 decoder_ = new media::MockAudioDecoder();
95 96
96 EXPECT_CALL(*decoder_, bits_per_channel()) 97 EXPECT_CALL(*decoder_, bits_per_channel())
97 .WillRepeatedly(Return(16)); 98 .WillRepeatedly(Return(16));
98 EXPECT_CALL(*decoder_, channel_layout()) 99 EXPECT_CALL(*decoder_, channel_layout())
99 .WillRepeatedly(Return(CHANNEL_LAYOUT_MONO)); 100 .WillRepeatedly(Return(CHANNEL_LAYOUT_MONO));
100 EXPECT_CALL(*decoder_, samples_per_second()) 101 EXPECT_CALL(*decoder_, samples_per_second())
101 .WillRepeatedly(Return(44100)); 102 .WillRepeatedly(Return(44100));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 base::Time time_now = base::Time(); // Null time by default. 179 base::Time time_now = base::Time(); // Null time by default.
179 renderer_->set_earliest_end_time(time_now); 180 renderer_->set_earliest_end_time(time_now);
180 renderer_->UpdateEarliestEndTime(renderer_->bytes_per_second(), 181 renderer_->UpdateEarliestEndTime(renderer_->bytes_per_second(),
181 base::TimeDelta::FromMilliseconds(100), 182 base::TimeDelta::FromMilliseconds(100),
182 time_now); 183 time_now);
183 int time_delta = (renderer_->earliest_end_time() - time_now).InMilliseconds(); 184 int time_delta = (renderer_->earliest_end_time() - time_now).InMilliseconds();
184 EXPECT_EQ(1100, time_delta); 185 EXPECT_EQ(1100, time_delta);
185 renderer_->Stop(media::NewExpectedClosure()); 186 renderer_->Stop(media::NewExpectedClosure());
186 WaitForIOThreadCompletion(); 187 WaitForIOThreadCompletion();
187 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698