| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "media/base/media_log.h" | 6 #include "media/base/media_log.h" |
| 7 #include "media/base/mock_callback.h" | 7 #include "media/base/mock_callback.h" |
| 8 #include "media/base/mock_data_source_host.h" | 8 #include "media/base/mock_data_source_host.h" |
| 9 #include "media/base/mock_filters.h" | 9 #include "media/base/mock_filters.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 BufferedResourceLoader* loader = | 47 BufferedResourceLoader* loader = |
| 48 BufferedDataSource::CreateResourceLoader(first_byte_position, | 48 BufferedDataSource::CreateResourceLoader(first_byte_position, |
| 49 last_byte_position); | 49 last_byte_position); |
| 50 | 50 |
| 51 // Keep track of active loading state via loadAsynchronously() and cancel(). | 51 // Keep track of active loading state via loadAsynchronously() and cancel(). |
| 52 NiceMock<MockWebURLLoader>* url_loader = new NiceMock<MockWebURLLoader>(); | 52 NiceMock<MockWebURLLoader>* url_loader = new NiceMock<MockWebURLLoader>(); |
| 53 ON_CALL(*url_loader, loadAsynchronously(_, _)) | 53 ON_CALL(*url_loader, loadAsynchronously(_, _)) |
| 54 .WillByDefault(Assign(&loading_, true)); | 54 .WillByDefault(Assign(&loading_, true)); |
| 55 ON_CALL(*url_loader, cancel()) | 55 ON_CALL(*url_loader, cancel()) |
| 56 .WillByDefault(Assign(&loading_, false)); | 56 .WillByDefault(Assign(&loading_, false)); |
| 57 | 57 scoped_ptr<NiceMock<MockWebURLLoader> > mwul(url_loader); |
| 58 loader->SetURLLoaderForTest(url_loader); | 58 // TODO(fischman): hopefully the extra scoped_ptr<WUL> will be |
| 59 // unnecessary once http://codereview.chromium.org/8968032/ lands |
| 60 // properly. |
| 61 scoped_ptr<WebURLLoader> wul(mwul.Pass()); |
| 62 loader->SetURLLoaderForTest(wul.Pass()); |
| 59 return loader; | 63 return loader; |
| 60 } | 64 } |
| 61 | 65 |
| 62 bool loading() { return loading_; } | 66 bool loading() { return loading_; } |
| 63 void set_loading(bool loading) { loading_ = loading; } | 67 void set_loading(bool loading) { loading_ = loading; } |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 // Whether the resource load has starting loading but yet to been cancelled. | 70 // Whether the resource load has starting loading but yet to been cancelled. |
| 67 bool loading_; | 71 bool loading_; |
| 68 | 72 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 452 |
| 449 // During teardown we'll also report our final network status. | 453 // During teardown we'll also report our final network status. |
| 450 EXPECT_CALL(host_, SetBufferedBytes(kDataSize)); | 454 EXPECT_CALL(host_, SetBufferedBytes(kDataSize)); |
| 451 //EXPECT_CALL(host_, SetNetworkActivity(false)); | 455 //EXPECT_CALL(host_, SetNetworkActivity(false)); |
| 452 | 456 |
| 453 EXPECT_TRUE(data_source_->loading()); | 457 EXPECT_TRUE(data_source_->loading()); |
| 454 Stop(); | 458 Stop(); |
| 455 } | 459 } |
| 456 | 460 |
| 457 } // namespace webkit_media | 461 } // namespace webkit_media |
| OLD | NEW |