summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-21 20:24:58 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-21 20:24:58 +0000
commit6e8afff24ed38abebc7537d97e1735ede5ca7755 (patch)
treecfcab05a0bb7b168108744d1353722ab6ba611a5
parent3b50bd3a2bb00f35e208201b54a1b4d0576c94d9 (diff)
downloadchromium_src-6e8afff24ed38abebc7537d97e1735ede5ca7755.zip
chromium_src-6e8afff24ed38abebc7537d97e1735ede5ca7755.tar.gz
chromium_src-6e8afff24ed38abebc7537d97e1735ede5ca7755.tar.bz2
Reverting r24002 due to test_shell_tests redness
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24004 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--media/base/filter_host.h3
-rw-r--r--media/base/mock_filter_host.h1
-rw-r--r--media/base/pipeline.h4
-rw-r--r--media/base/pipeline_impl.cc12
-rw-r--r--media/base/pipeline_impl.h6
-rw-r--r--webkit/glue/media/buffered_data_source.cc3
-rw-r--r--webkit/glue/media/buffered_data_source_unittest.cc44
-rw-r--r--webkit/glue/media/simple_data_source.cc2
-rw-r--r--webkit/glue/webmediaplayer_impl.cc13
9 files changed, 13 insertions, 75 deletions
diff --git a/media/base/filter_host.h b/media/base/filter_host.h
index 2b288d2..02ae399 100644
--- a/media/base/filter_host.h
+++ b/media/base/filter_host.h
@@ -61,9 +61,6 @@ class FilterHost {
// endpoints such as renderers.
virtual void NotifyEnded() = 0;
- // Sets the flag to indicate that our media is now loaded.
- virtual void SetLoaded(bool loaded) = 0;
-
// Broadcast a message of type |message| to all other filters from |source|.
virtual void BroadcastMessage(FilterMessage message) = 0;
diff --git a/media/base/mock_filter_host.h b/media/base/mock_filter_host.h
index dfcf403..439eda8 100644
--- a/media/base/mock_filter_host.h
+++ b/media/base/mock_filter_host.h
@@ -37,7 +37,6 @@ class MockFilterHost : public FilterHost {
MOCK_METHOD1(SetBufferedBytes, void(int64 buffered_bytes));
MOCK_METHOD2(SetVideoSize, void(size_t width, size_t height));
MOCK_METHOD1(SetStreaming, void(bool streamed));
- MOCK_METHOD1(SetLoaded, void(bool loaded));
MOCK_METHOD0(NotifyEnded, void());
MOCK_METHOD1(BroadcastMessage, void(FilterMessage message));
diff --git a/media/base/pipeline.h b/media/base/pipeline.h
index dd571c9..b54d442 100644
--- a/media/base/pipeline.h
+++ b/media/base/pipeline.h
@@ -151,10 +151,6 @@ class Pipeline : public base::RefCountedThreadSafe<Pipeline> {
// data source. Seeking may not be possible.
virtual bool IsStreaming() const = 0;
- // If this method returns true, that means the data source has fully loaded
- // the media and that the network is no longer needed.
- virtual bool IsLoaded() const = 0;
-
// Gets the current error status for the pipeline. If the pipeline is
// operating correctly, this will return OK.
virtual PipelineError GetError() const = 0;
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index 49ebe4a..270347c 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -262,11 +262,6 @@ bool PipelineImpl::IsStreaming() const {
return streaming_;
}
-bool PipelineImpl::IsLoaded() const {
- AutoLock auto_lock(lock_);
- return loaded_;
-}
-
PipelineError PipelineImpl::GetError() const {
AutoLock auto_lock(lock_);
return error_;
@@ -292,7 +287,6 @@ void PipelineImpl::ResetState() {
buffered_time_ = kZero;
buffered_bytes_ = 0;
streaming_ = false;
- loaded_ = false;
total_bytes_ = 0;
video_width_ = 0;
video_height_ = 0;
@@ -411,12 +405,6 @@ void PipelineImpl::NotifyEnded() {
NewRunnableMethod(this, &PipelineImpl::NotifyEndedTask));
}
-void PipelineImpl::SetLoaded(bool loaded) {
- DCHECK(IsRunning());
- AutoLock auto_lock(lock_);
- loaded_ = loaded;
-}
-
void PipelineImpl::BroadcastMessage(FilterMessage message) {
DCHECK(IsRunning());
diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h
index 891404a..c448106 100644
--- a/media/base/pipeline_impl.h
+++ b/media/base/pipeline_impl.h
@@ -84,7 +84,6 @@ class PipelineImpl : public Pipeline, public FilterHost {
virtual int64 GetTotalBytes() const;
virtual void GetVideoSize(size_t* width_out, size_t* height_out) const;
virtual bool IsStreaming() const;
- virtual bool IsLoaded() const;
virtual PipelineError GetError() const;
// Sets a permanent callback owned by the pipeline that will be executed when
@@ -144,7 +143,6 @@ class PipelineImpl : public Pipeline, public FilterHost {
virtual void SetBufferedBytes(int64 buffered_bytes);
virtual void SetVideoSize(size_t width, size_t height);
virtual void SetStreaming(bool streamed);
- virtual void SetLoaded(bool loaded);
virtual void NotifyEnded();
virtual void BroadcastMessage(FilterMessage message);
@@ -295,10 +293,6 @@ class PipelineImpl : public Pipeline, public FilterHost {
// source.
bool streaming_;
- // Sets by the filters to indicate whether the data source is a fully
- // loaded source.
- bool loaded_;
-
// Current volume level (from 0.0f to 1.0f). This value is set immediately
// via SetVolume() and a task is dispatched on the message loop to notify the
// filters.
diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc
index 6726885..5f739ba 100644
--- a/webkit/glue/media/buffered_data_source.cc
+++ b/webkit/glue/media/buffered_data_source.cc
@@ -765,9 +765,6 @@ void BufferedDataSource::InitialStartCallback(int error) {
host()->SetStreaming(true);
}
- // Currently, only files can be used reliably w/o a network.
- host()->SetLoaded(url_.SchemeIsFile());
-
initial_response_received_ = true;
if (probe_response_received_)
DoneInitialization();
diff --git a/webkit/glue/media/buffered_data_source_unittest.cc b/webkit/glue/media/buffered_data_source_unittest.cc
index 003313c..4d9efe8 100644
--- a/webkit/glue/media/buffered_data_source_unittest.cc
+++ b/webkit/glue/media/buffered_data_source_unittest.cc
@@ -30,15 +30,8 @@ using ::testing::WithArgs;
namespace {
const char* kHttpUrl = "http://test";
-const char* kFileUrl = "file://test";
const int kDataSize = 1024;
-enum NetworkState {
- NONE,
- LOADED,
- LOADING
-};
-
} // namespace
namespace webkit_glue {
@@ -407,7 +400,7 @@ class BufferedDataSourceTest : public testing::Test {
}
}
- virtual ~BufferedDataSourceTest() {
+ ~BufferedDataSourceTest() {
if (data_source_) {
// Release the bridge factory because we don't own it.
// Expects bridge factory to be destroyed along with data source.
@@ -421,7 +414,7 @@ class BufferedDataSourceTest : public testing::Test {
}
void InitializeDataSource(const char* url, int error, int probe_error,
- int64 instance_size, NetworkState networkState) {
+ int64 instance_size) {
// Saves the url first.
gurl_ = GURL(url);
@@ -439,14 +432,6 @@ class BufferedDataSourceTest : public testing::Test {
loader_ = new StrictMock<MockBufferedResourceLoader>();
probe_loader_ = new StrictMock<MockBufferedResourceLoader>();
- if (networkState == LOADED) {
- EXPECT_CALL(host_, SetLoaded(true));
- } else if (networkState == LOADING) {
- EXPECT_CALL(host_, SetLoaded(false));
- }
-
- // TODO(ajwong): This mock is too strict. We do not need to guarantee a
- // full sequencing each of these expectations.
InSequence s;
StrictMock<media::MockFilterCallback> callback;
@@ -463,7 +448,6 @@ class BufferedDataSourceTest : public testing::Test {
.WillOnce(DoAll(Assign(&error_, error),
Invoke(this,
&BufferedDataSourceTest::InvokeStartCallback)));
-
if (error == net::OK) {
EXPECT_CALL(*loader_, instance_size())
.WillOnce(Return(instance_size));
@@ -705,36 +689,36 @@ class BufferedDataSourceTest : public testing::Test {
};
TEST_F(BufferedDataSourceTest, InitializationSuccess) {
- InitializeDataSource(kHttpUrl, net::OK, net::OK, 1024, LOADING);
+ InitializeDataSource(kHttpUrl, net::OK, net::OK, 1024);
StopDataSource();
}
TEST_F(BufferedDataSourceTest, InitiailizationFailed) {
InitializeDataSource(kHttpUrl, net::ERR_FILE_NOT_FOUND,
- net::ERR_FILE_NOT_FOUND, 0, NONE);
+ net::ERR_FILE_NOT_FOUND, 0);
StopDataSource();
}
TEST_F(BufferedDataSourceTest, MissingContentLength) {
- InitializeDataSource(kHttpUrl, net::OK, net::OK, -1, LOADING);
+ InitializeDataSource(kHttpUrl, net::OK, net::OK, -1);
StopDataSource();
}
TEST_F(BufferedDataSourceTest, RangeRequestNotSupported) {
InitializeDataSource(kHttpUrl, net::OK,
- net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, 1024, LOADING);
+ net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, 1024);
StopDataSource();
}
TEST_F(BufferedDataSourceTest,
MissingContentLengthAndRangeRequestNotSupported) {
InitializeDataSource(kHttpUrl, net::OK,
- net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, -1, LOADING);
+ net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, -1);
StopDataSource();
}
TEST_F(BufferedDataSourceTest, ReadCacheHit) {
- InitializeDataSource(kHttpUrl, net::OK, net::OK, 25, LOADING);
+ InitializeDataSource(kHttpUrl, net::OK, net::OK, 25);
// Performs read with cache hit.
ReadDataSourceHit(10, 10, 10);
@@ -746,27 +730,21 @@ TEST_F(BufferedDataSourceTest, ReadCacheHit) {
}
TEST_F(BufferedDataSourceTest, ReadCacheMiss) {
- InitializeDataSource(kHttpUrl, net::OK, net::OK, 1024, LOADING);
+ InitializeDataSource(kHttpUrl, net::OK, net::OK, 1024);
ReadDataSourceMiss(1000, 10);
ReadDataSourceMiss(20, 10);
StopDataSource();
}
TEST_F(BufferedDataSourceTest, ReadFailed) {
- InitializeDataSource(kHttpUrl, net::OK, net::OK, 1024, LOADING);
+ InitializeDataSource(kHttpUrl, net::OK, net::OK, 1024);
ReadDataSourceHit(10, 10, 10);
ReadDataSourceFailed(10, 10, net::ERR_CONNECTION_RESET);
StopDataSource();
}
TEST_F(BufferedDataSourceTest, ReadTimesOut) {
- InitializeDataSource(kHttpUrl, net::OK, net::OK, 1024, LOADING);
- ReadDataSourceTimesOut(20, 10);
- StopDataSource();
-}
-
-TEST_F(BufferedDataSourceTest, FileHasLoadedState) {
- InitializeDataSource(kFileUrl, net::OK, net::OK, 1024, LOADED);
+ InitializeDataSource(kHttpUrl, net::OK, net::OK, 1024);
ReadDataSourceTimesOut(20, 10);
StopDataSource();
}
diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc
index 52ea388..639aa5f 100644
--- a/webkit/glue/media/simple_data_source.cc
+++ b/webkit/glue/media/simple_data_source.cc
@@ -71,8 +71,6 @@ void SimpleDataSource::Initialize(const std::string& url,
return;
}
- host()->SetLoaded(url_.SchemeIsFile());
-
// Post a task to the render thread to start loading the resource.
render_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, &SimpleDataSource::StartTask));
diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc
index 0438e54..d3d3679 100644
--- a/webkit/glue/webmediaplayer_impl.cc
+++ b/webkit/glue/webmediaplayer_impl.cc
@@ -272,7 +272,6 @@ void WebMediaPlayerImpl::seek(float seconds) {
// Try to preserve as much accuracy as possible.
float microseconds = seconds * base::Time::kMicrosecondsPerSecond;
- SetReadyState(WebKit::WebMediaPlayer::HaveMetadata);
pipeline_->Seek(
base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)),
NewCallback(proxy_.get(),
@@ -362,10 +361,7 @@ bool WebMediaPlayerImpl::paused() const {
bool WebMediaPlayerImpl::seeking() const {
DCHECK(MessageLoop::current() == main_loop_);
- if (ready_state_ == WebKit::WebMediaPlayer::HaveNothing)
- return false;
-
- return ready_state_ == WebKit::WebMediaPlayer::HaveMetadata;
+ return false;
}
float WebMediaPlayerImpl::duration() const {
@@ -471,11 +467,7 @@ void WebMediaPlayerImpl::OnPipelineInitialize() {
// TODO(hclam): change this to report the correct status.
SetReadyState(WebKit::WebMediaPlayer::HaveMetadata);
SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData);
- if (pipeline_->IsLoaded()) {
- SetNetworkState(WebKit::WebMediaPlayer::Loaded);
- } else {
- SetNetworkState(WebKit::WebMediaPlayer::Loading);
- }
+ SetNetworkState(WebKit::WebMediaPlayer::Loaded);
} else {
// TODO(hclam): should use pipeline_->GetError() to determine the state
// properly and reports error using MediaError.
@@ -492,7 +484,6 @@ void WebMediaPlayerImpl::OnPipelineInitialize() {
void WebMediaPlayerImpl::OnPipelineSeek() {
DCHECK(MessageLoop::current() == main_loop_);
if (pipeline_->GetError() == media::PIPELINE_OK) {
- SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData);
GetClient()->timeChanged();
}
}