| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
| 8 #include "media/base/mock_callback.h" | 8 #include "media/base/mock_callback.h" |
| 9 #include "media/base/mock_filter_host.h" | 9 #include "media/base/mock_filter_host.h" |
| 10 #include "media/base/mock_filters.h" | 10 #include "media/base/mock_filters.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 using ::testing::Invoke; | 23 using ::testing::Invoke; |
| 24 using ::testing::InvokeWithoutArgs; | 24 using ::testing::InvokeWithoutArgs; |
| 25 using ::testing::NotNull; | 25 using ::testing::NotNull; |
| 26 using ::testing::Return; | 26 using ::testing::Return; |
| 27 using ::testing::ReturnRef; | 27 using ::testing::ReturnRef; |
| 28 using ::testing::SetArgumentPointee; | 28 using ::testing::SetArgumentPointee; |
| 29 using ::testing::StrictMock; | 29 using ::testing::StrictMock; |
| 30 using ::testing::NiceMock; | 30 using ::testing::NiceMock; |
| 31 using ::testing::WithArgs; | 31 using ::testing::WithArgs; |
| 32 | 32 |
| 33 namespace { | 33 namespace webkit_glue { |
| 34 | 34 |
| 35 const char* kHttpUrl = "http://test"; | 35 static const char* kHttpUrl = "http://test"; |
| 36 const char* kFileUrl = "file://test"; | 36 static const char* kFileUrl = "file://test"; |
| 37 const int kDataSize = 1024; | 37 static const int kDataSize = 1024; |
| 38 | 38 |
| 39 enum NetworkState { | 39 enum NetworkState { |
| 40 NONE, | 40 NONE, |
| 41 LOADED, | 41 LOADED, |
| 42 LOADING | 42 LOADING |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 } // namespace | |
| 46 | |
| 47 namespace webkit_glue { | |
| 48 | |
| 49 // A mock BufferedDataSource to inject mock BufferedResourceLoader through | 45 // A mock BufferedDataSource to inject mock BufferedResourceLoader through |
| 50 // CreateResourceLoader() method. | 46 // CreateResourceLoader() method. |
| 51 class MockBufferedDataSource : public BufferedDataSource { | 47 class MockBufferedDataSource : public BufferedDataSource { |
| 52 public: | 48 public: |
| 53 MockBufferedDataSource( | 49 MockBufferedDataSource(MessageLoop* message_loop, WebFrame* frame) |
| 54 MessageLoop* message_loop, WebFrame* frame) | |
| 55 : BufferedDataSource(message_loop, frame) { | 50 : BufferedDataSource(message_loop, frame) { |
| 56 } | 51 } |
| 57 | 52 |
| 58 virtual base::TimeDelta GetTimeoutMilliseconds() { | 53 virtual base::TimeDelta GetTimeoutMilliseconds() { |
| 59 return base::TimeDelta::FromMilliseconds( | 54 return base::TimeDelta::FromMilliseconds( |
| 60 TestTimeouts::tiny_timeout_ms()); | 55 TestTimeouts::tiny_timeout_ms()); |
| 61 } | 56 } |
| 62 | 57 |
| 63 MOCK_METHOD2(CreateResourceLoader, | 58 MOCK_METHOD2(CreateResourceLoader, |
| 64 BufferedResourceLoader*(int64 first_position, | 59 BufferedResourceLoader*(int64 first_position, |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 data_source_->Stop(media::NewExpectedCallback()); | 547 data_source_->Stop(media::NewExpectedCallback()); |
| 553 | 548 |
| 554 // Allow cleanup task to run. | 549 // Allow cleanup task to run. |
| 555 message_loop_->RunAllPending(); | 550 message_loop_->RunAllPending(); |
| 556 | 551 |
| 557 // Verify that Read() was not called on the loader. | 552 // Verify that Read() was not called on the loader. |
| 558 EXPECT_FALSE(read_called); | 553 EXPECT_FALSE(read_called); |
| 559 } | 554 } |
| 560 | 555 |
| 561 } // namespace webkit_glue | 556 } // namespace webkit_glue |
| OLD | NEW |