| 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): replace the extra scoped_ptr+release() with Pass() when |
| 59 // http://crbug.com/109026 is fixed. |
| 60 scoped_ptr<WebURLLoader> wul(mwul.release()); |
| 61 loader->SetURLLoaderForTest(wul.Pass()); |
| 59 return loader; | 62 return loader; |
| 60 } | 63 } |
| 61 | 64 |
| 62 bool loading() { return loading_; } | 65 bool loading() { return loading_; } |
| 63 void set_loading(bool loading) { loading_ = loading; } | 66 void set_loading(bool loading) { loading_ = loading; } |
| 64 | 67 |
| 65 private: | 68 private: |
| 66 // Whether the resource load has starting loading but yet to been cancelled. | 69 // Whether the resource load has starting loading but yet to been cancelled. |
| 67 bool loading_; | 70 bool loading_; |
| 68 | 71 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 451 |
| 449 // During teardown we'll also report our final network status. | 452 // During teardown we'll also report our final network status. |
| 450 EXPECT_CALL(host_, SetBufferedBytes(kDataSize)); | 453 EXPECT_CALL(host_, SetBufferedBytes(kDataSize)); |
| 451 //EXPECT_CALL(host_, SetNetworkActivity(false)); | 454 //EXPECT_CALL(host_, SetNetworkActivity(false)); |
| 452 | 455 |
| 453 EXPECT_TRUE(data_source_->loading()); | 456 EXPECT_TRUE(data_source_->loading()); |
| 454 Stop(); | 457 Stop(); |
| 455 } | 458 } |
| 456 | 459 |
| 457 } // namespace webkit_media | 460 } // namespace webkit_media |
| OLD | NEW |