| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 static const int kDataSize = 1024; | 112 static const int kDataSize = 1024; |
| 113 | 113 |
| 114 static const char kHttpUrl[] = "http://localhost/foo.webm"; | 114 static const char kHttpUrl[] = "http://localhost/foo.webm"; |
| 115 static const char kFileUrl[] = "file:///tmp/bar.webm"; | 115 static const char kFileUrl[] = "file:///tmp/bar.webm"; |
| 116 static const char kHttpDifferentPathUrl[] = "http://localhost/bar.webm"; | 116 static const char kHttpDifferentPathUrl[] = "http://localhost/bar.webm"; |
| 117 static const char kHttpDifferentOriginUrl[] = "http://127.0.0.1/foo.webm"; | 117 static const char kHttpDifferentOriginUrl[] = "http://127.0.0.1/foo.webm"; |
| 118 | 118 |
| 119 class BufferedDataSourceTest : public testing::Test { | 119 class BufferedDataSourceTest : public testing::Test { |
| 120 public: | 120 public: |
| 121 BufferedDataSourceTest() | 121 BufferedDataSourceTest() |
| 122 : view_(WebView::create(NULL)), | 122 : view_(WebView::create(nullptr, blink::WebPageVisibilityStateVisible)), |
| 123 frame_( | 123 frame_( |
| 124 WebLocalFrame::create(blink::WebTreeScopeType::Document, &client_)), | 124 WebLocalFrame::create(blink::WebTreeScopeType::Document, &client_)), |
| 125 bytes_received_(0), | 125 bytes_received_(0), |
| 126 preload_(BufferedDataSource::AUTO) { | 126 preload_(BufferedDataSource::AUTO) { |
| 127 view_->setMainFrame(frame_); | 127 view_->setMainFrame(frame_); |
| 128 } | 128 } |
| 129 | 129 |
| 130 virtual ~BufferedDataSourceTest() { | 130 virtual ~BufferedDataSourceTest() { |
| 131 view_->close(); | 131 view_->close(); |
| 132 frame_->close(); | 132 frame_->close(); |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 while (active_loader() && !active_loader()->deferred()) { | 1106 while (active_loader() && !active_loader()->deferred()) { |
| 1107 ReceiveData(kDataSize); | 1107 ReceiveData(kDataSize); |
| 1108 bytes_received += kDataSize; | 1108 bytes_received += kDataSize; |
| 1109 } | 1109 } |
| 1110 EXPECT_GT(bytes_received, 0); | 1110 EXPECT_GT(bytes_received, 0); |
| 1111 EXPECT_LT(bytes_received + kDataSize, kFileSize); | 1111 EXPECT_LT(bytes_received + kDataSize, kFileSize); |
| 1112 EXPECT_FALSE(active_loader()); | 1112 EXPECT_FALSE(active_loader()); |
| 1113 } | 1113 } |
| 1114 | 1114 |
| 1115 } // namespace media | 1115 } // namespace media |
| OLD | NEW |