diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-16 00:18:33 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-16 00:18:33 +0000 |
commit | df8648dfbf4057d8d9ef58f1565e4d7478d41ad5 (patch) | |
tree | 16fb334851bfb1893ec1897bd642dbda8d007bfa /webkit/media | |
parent | 8fd07fc1d29ebb59b02fcac515cd9d2dc8201d75 (diff) | |
download | chromium_src-df8648dfbf4057d8d9ef58f1565e4d7478d41ad5.zip chromium_src-df8648dfbf4057d8d9ef58f1565e4d7478d41ad5.tar.gz chromium_src-df8648dfbf4057d8d9ef58f1565e4d7478d41ad5.tar.bz2 |
Move webkit/media tests from test_shell_tests into content_unittests
This moves BufferedDataSourceTest.*, BufferedResourceLoaderTest.*, and
SkCanvasVideoRendererTest.* from test_shell_tests into content_unittests.
I modified the Buffered* tests to create their own MessageLoop.
BUG=126514
Review URL: https://chromiumcodereview.appspot.com/10377135
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137313 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/media')
-rw-r--r-- | webkit/media/buffered_data_source_unittest.cc | 31 | ||||
-rw-r--r-- | webkit/media/buffered_resource_loader_unittest.cc | 2 |
2 files changed, 17 insertions, 16 deletions
diff --git a/webkit/media/buffered_data_source_unittest.cc b/webkit/media/buffered_data_source_unittest.cc index 5cc89da..0949523 100644 --- a/webkit/media/buffered_data_source_unittest.cc +++ b/webkit/media/buffered_data_source_unittest.cc @@ -82,11 +82,10 @@ class BufferedDataSourceTest : public testing::Test { public: BufferedDataSourceTest() : response_generator_(GURL("http://localhost/foo.webm"), kFileSize), - view_(WebView::create(NULL)), - message_loop_(MessageLoop::current()) { + view_(WebView::create(NULL)) { view_->initializeMainFrame(&client_); - data_source_ = new MockBufferedDataSource(message_loop_, + data_source_ = new MockBufferedDataSource(&message_loop_, view_->mainFrame()); data_source_->set_host(&host_); } @@ -99,7 +98,7 @@ class BufferedDataSourceTest : public testing::Test { ExpectCreateResourceLoader(); data_source_->Initialize(response_generator_.gurl(), media::NewExpectedStatusCB(expected)); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); } // Helper to initialize tests with a valid 206 response. @@ -118,34 +117,34 @@ class BufferedDataSourceTest : public testing::Test { void Stop() { if (data_source_->loading()) { loader()->didFail(url_loader(), response_generator_.GenerateError()); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); } data_source_->Stop(media::NewExpectedClosure()); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); } void ExpectCreateResourceLoader() { EXPECT_CALL(*data_source_, CreateResourceLoader(_, _)) .WillOnce(Invoke(data_source_.get(), &MockBufferedDataSource::CreateMockResourceLoader)); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); } void Respond(const WebURLResponse& response) { loader()->didReceiveResponse(url_loader(), response); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); } void FinishRead() { loader()->didReceiveData(url_loader(), data_, kDataSize, kDataSize); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); } void FinishLoading() { data_source_->set_loading(false); loader()->didFinishLoading(url_loader(), 0); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); } MOCK_METHOD1(ReadCallback, void(int size)); @@ -154,7 +153,7 @@ class BufferedDataSourceTest : public testing::Test { data_source_->Read(position, kDataSize, buffer_, base::Bind(&BufferedDataSourceTest::ReadCallback, base::Unretained(this))); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); } // Accessors for private variables on |data_source_|. @@ -182,7 +181,7 @@ class BufferedDataSourceTest : public testing::Test { WebView* view_; StrictMock<media::MockDataSourceHost> host_; - MessageLoop* message_loop_; + MessageLoop message_loop_; private: // Used for calling BufferedDataSource::Read(). @@ -312,7 +311,7 @@ TEST_F(BufferedDataSourceTest, Range_AbortWhileReading) { // Abort!!! EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)); data_source_->Abort(); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); EXPECT_FALSE(data_source_->loading()); Stop(); @@ -367,7 +366,7 @@ TEST_F(BufferedDataSourceTest, StopDoesNotUseMessageLoopForCallback) { // Verify that the callback was called inside the Stop() call. EXPECT_TRUE(stop_done_called); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); } TEST_F(BufferedDataSourceTest, DefaultValues) { @@ -390,7 +389,7 @@ TEST_F(BufferedDataSourceTest, SetBitrate) { InitializeWith206Response(); data_source_->SetBitrate(1234); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); EXPECT_EQ(1234, data_source_bitrate()); EXPECT_EQ(1234, loader_bitrate()); @@ -416,7 +415,7 @@ TEST_F(BufferedDataSourceTest, SetPlaybackRate) { InitializeWith206Response(); data_source_->SetPlaybackRate(2.0f); - message_loop_->RunAllPending(); + message_loop_.RunAllPending(); EXPECT_EQ(2.0f, data_source_playback_rate()); EXPECT_EQ(2.0f, loader_playback_rate()); diff --git a/webkit/media/buffered_resource_loader_unittest.cc b/webkit/media/buffered_resource_loader_unittest.cc index 35fc24d..541c5a8 100644 --- a/webkit/media/buffered_resource_loader_unittest.cc +++ b/webkit/media/buffered_resource_loader_unittest.cc @@ -303,6 +303,8 @@ class BufferedResourceLoaderTest : public testing::Test { MockWebFrameClient client_; WebView* view_; + MessageLoop message_loop_; + uint8 data_[kDataSize]; private: |