Index: webkit/media/buffered_data_source_unittest.cc |
diff --git a/webkit/media/buffered_data_source_unittest.cc b/webkit/media/buffered_data_source_unittest.cc |
index ce14c7abc03f5fc126a8230c894bd2c3df67803f..f75fde28ca3b9c05ff956880ae0772e20132c9aa 100644 |
--- a/webkit/media/buffered_data_source_unittest.cc |
+++ b/webkit/media/buffered_data_source_unittest.cc |
@@ -50,10 +50,10 @@ static const char* kFileUrl = "file://test"; |
static const int kDataSize = 1024; |
static const int kMaxCacheMissesBeforeFailTest = 20; |
-enum NetworkState { |
+enum SourceType { |
NONE, |
- LOADED, |
- LOADING |
+ LOCAL, |
+ REMOTE |
}; |
// A mock BufferedDataSource to inject mock BufferedResourceLoader through |
@@ -133,7 +133,7 @@ class BufferedDataSourceTest : public testing::Test { |
void InitializeDataSource(const char* url, int error, |
bool partial_response, int64 instance_size, |
- NetworkState networkState) { |
+ SourceType source_type) { |
// Saves the url first. |
gurl_ = GURL(url); |
@@ -148,7 +148,7 @@ class BufferedDataSourceTest : public testing::Test { |
loader_ = first_loader; |
bool initialized_ok = (error == net::OK); |
- bool loaded = networkState == LOADED; |
+ bool local_source = source_type == LOCAL; |
{ |
InSequence s; |
ExpectCreateAndStartResourceLoader(error); |
@@ -189,13 +189,13 @@ class BufferedDataSourceTest : public testing::Test { |
.WillByDefault(ReturnRef(gurl_)); |
media::PipelineStatus expected_init_status = media::PIPELINE_OK; |
if (initialized_ok) { |
- // Expected loaded or not. |
- EXPECT_CALL(host_, SetLoaded(loaded)); |
+ // Media is a local file or not. |
+ EXPECT_CALL(host_, SetLocalSourceFromFilter(local_source)); |
if (instance_size != -1) |
EXPECT_CALL(host_, SetTotalBytes(instance_size)); |
- if (loaded) |
+ if (local_source) |
EXPECT_CALL(host_, SetBufferedBytes(instance_size)); |
else |
EXPECT_CALL(host_, SetBufferedBytes(0)); |
@@ -216,7 +216,7 @@ class BufferedDataSourceTest : public testing::Test { |
if (initialized_ok) { |
// Verify the size of the data source. |
int64 size; |
- if (instance_size != -1 && (loaded || partial_response)) { |
+ if (instance_size != -1 && (local_source || partial_response)) { |
EXPECT_TRUE(data_source_->GetSize(&size)); |
EXPECT_EQ(instance_size, size); |
} else { |
@@ -452,7 +452,7 @@ class BufferedDataSourceTest : public testing::Test { |
}; |
TEST_F(BufferedDataSourceTest, InitializationSuccess) { |
- InitializeDataSource(kHttpUrl, net::OK, true, 1024, LOADING); |
+ InitializeDataSource(kHttpUrl, net::OK, true, 1024, REMOTE); |
StopDataSource(); |
} |
@@ -462,30 +462,30 @@ TEST_F(BufferedDataSourceTest, InitiailizationFailed) { |
} |
TEST_F(BufferedDataSourceTest, MissingContentLength) { |
- InitializeDataSource(kHttpUrl, net::OK, true, -1, LOADING); |
+ InitializeDataSource(kHttpUrl, net::OK, true, -1, REMOTE); |
StopDataSource(); |
} |
TEST_F(BufferedDataSourceTest, RangeRequestNotSupported) { |
- InitializeDataSource(kHttpUrl, net::OK, false, 1024, LOADING); |
+ InitializeDataSource(kHttpUrl, net::OK, false, 1024, REMOTE); |
StopDataSource(); |
} |
// Test the case where we get a 206 response, but no Content-Range header. |
TEST_F(BufferedDataSourceTest, MissingContentRange) { |
InitializeDataSource(kHttpUrl, net::ERR_INVALID_RESPONSE, true, 1024, |
- LOADING); |
+ REMOTE); |
StopDataSource(); |
} |
TEST_F(BufferedDataSourceTest, |
MissingContentLengthAndRangeRequestNotSupported) { |
- InitializeDataSource(kHttpUrl, net::OK, false, -1, LOADING); |
+ InitializeDataSource(kHttpUrl, net::OK, false, -1, REMOTE); |
StopDataSource(); |
} |
TEST_F(BufferedDataSourceTest, ReadCacheHit) { |
- InitializeDataSource(kHttpUrl, net::OK, true, 25, LOADING); |
+ InitializeDataSource(kHttpUrl, net::OK, true, 25, REMOTE); |
// Performs read with cache hit. |
ReadDataSourceHit(10, 10, 10); |
@@ -497,7 +497,7 @@ TEST_F(BufferedDataSourceTest, ReadCacheHit) { |
} |
TEST_F(BufferedDataSourceTest, ReadCacheMiss) { |
- InitializeDataSource(kHttpUrl, net::OK, true, 1024, LOADING); |
+ InitializeDataSource(kHttpUrl, net::OK, true, 1024, REMOTE); |
ReadDataSourceMiss(1000, 10, net::OK); |
ReadDataSourceMiss(20, 10, net::OK); |
StopDataSource(); |
@@ -506,20 +506,20 @@ TEST_F(BufferedDataSourceTest, ReadCacheMiss) { |
// Test the case where the initial response from the server indicates that |
// Range requests are supported, but a later request prove otherwise. |
TEST_F(BufferedDataSourceTest, ServerLiesAboutRangeSupport) { |
- InitializeDataSource(kHttpUrl, net::OK, true, 1024, LOADING); |
+ InitializeDataSource(kHttpUrl, net::OK, true, 1024, REMOTE); |
ReadDataSourceHit(10, 10, 10); |
ReadDataSourceMiss(1000, 10, net::ERR_INVALID_RESPONSE); |
StopDataSource(); |
} |
TEST_F(BufferedDataSourceTest, ReadHang) { |
- InitializeDataSource(kHttpUrl, net::OK, true, 25, LOADING); |
+ InitializeDataSource(kHttpUrl, net::OK, true, 25, REMOTE); |
ReadDataSourceHang(10, 10); |
StopDataSource(); |
} |
TEST_F(BufferedDataSourceTest, ReadFailed) { |
- InitializeDataSource(kHttpUrl, net::OK, true, 1024, LOADING); |
+ InitializeDataSource(kHttpUrl, net::OK, true, 1024, REMOTE); |
ReadDataSourceHit(10, 10, 10); |
ReadDataSourceFailed(10, 10, net::ERR_CONNECTION_RESET); |
StopDataSource(); |
@@ -537,7 +537,7 @@ static void SetTrue(bool* value) { |
// object runs on the render message loop, Stop() will not complete if it |
// requires a task to run on the the message loop that is being blocked. |
TEST_F(BufferedDataSourceTest, StopDoesNotUseMessageLoopForCallback) { |
- InitializeDataSource(kFileUrl, net::OK, true, 1024, LOADED); |
+ InitializeDataSource(kFileUrl, net::OK, true, 1024, LOCAL); |
// Stop() the data source, using a callback that lets us verify that it was |
// called before Stop() returns. This is to make sure that the callback does |
@@ -552,7 +552,7 @@ TEST_F(BufferedDataSourceTest, StopDoesNotUseMessageLoopForCallback) { |
} |
TEST_F(BufferedDataSourceTest, AbortDuringPendingRead) { |
- InitializeDataSource(kFileUrl, net::OK, true, 1024, LOADED); |
+ InitializeDataSource(kFileUrl, net::OK, true, 1024, LOCAL); |
// Setup a way to verify that Read() is not called on the loader. |
// We are doing this to make sure that the ReadTask() is still on |
@@ -594,7 +594,7 @@ TEST_F(BufferedDataSourceTest, AbortDuringPendingRead) { |
// Test that we only allow a limited number of cache misses for a |
// single Read() request. |
TEST_F(BufferedDataSourceTest, BoundedCacheMisses) { |
- InitializeDataSource(kHttpUrl, net::OK, true, 1024, LOADING); |
+ InitializeDataSource(kHttpUrl, net::OK, true, 1024, REMOTE); |
ReadDataSourceAlwaysCacheMiss(0, 10); |
@@ -683,7 +683,7 @@ class BufferedDataSourceTest2 : public testing::Test { |
response.setHTTPStatusCode(206); |
// We should receive corresponding information about the media resource. |
- EXPECT_CALL(host_, SetLoaded(false)); |
+ EXPECT_CALL(host_, SetLocalSourceFromFilter(false)); |
EXPECT_CALL(host_, SetTotalBytes(5000000)); |
EXPECT_CALL(host_, SetBufferedBytes(0)); |