Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: content/renderer/media/buffered_resource_loader_unittest.cc

Issue 231793004: Update a few more references to WebFrame to use WebLocalFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "content/renderer/media/buffered_resource_loader.h" 12 #include "content/renderer/media/buffered_resource_loader.h"
13 #include "content/test/mock_webframeclient.h" 13 #include "content/test/mock_webframeclient.h"
14 #include "content/test/mock_weburlloader.h" 14 #include "content/test/mock_weburlloader.h"
15 #include "media/base/media_log.h" 15 #include "media/base/media_log.h"
16 #include "media/base/seekable_buffer.h" 16 #include "media/base/seekable_buffer.h"
17 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
18 #include "net/http/http_request_headers.h" 18 #include "net/http/http_request_headers.h"
19 #include "net/http/http_util.h" 19 #include "net/http/http_util.h"
20 #include "third_party/WebKit/public/platform/WebString.h" 20 #include "third_party/WebKit/public/platform/WebString.h"
21 #include "third_party/WebKit/public/platform/WebURLError.h" 21 #include "third_party/WebKit/public/platform/WebURLError.h"
22 #include "third_party/WebKit/public/platform/WebURLRequest.h" 22 #include "third_party/WebKit/public/platform/WebURLRequest.h"
23 #include "third_party/WebKit/public/platform/WebURLResponse.h" 23 #include "third_party/WebKit/public/platform/WebURLResponse.h"
24 #include "third_party/WebKit/public/web/WebFrame.h" 24 #include "third_party/WebKit/public/web/WebLocalFrame.h"
25 #include "third_party/WebKit/public/web/WebView.h" 25 #include "third_party/WebKit/public/web/WebView.h"
26 26
27 using ::testing::_; 27 using ::testing::_;
28 using ::testing::InSequence; 28 using ::testing::InSequence;
29 using ::testing::Return; 29 using ::testing::Return;
30 using ::testing::Truly; 30 using ::testing::Truly;
31 using ::testing::NiceMock; 31 using ::testing::NiceMock;
32 32
33 using blink::WebFrame; 33 using blink::WebLocalFrame;
34 using blink::WebString; 34 using blink::WebString;
35 using blink::WebURLError; 35 using blink::WebURLError;
36 using blink::WebURLResponse; 36 using blink::WebURLResponse;
37 using blink::WebView; 37 using blink::WebView;
38 38
39 namespace content { 39 namespace content {
40 40
41 static const char* kHttpUrl = "http://test"; 41 static const char* kHttpUrl = "http://test";
42 static const char kHttpRedirectToSameDomainUrl1[] = "http://test/ing"; 42 static const char kHttpRedirectToSameDomainUrl1[] = "http://test/ing";
43 static const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; 43 static const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2";
(...skipping 13 matching lines...) Expand all
57 static bool CorrectAcceptEncoding(const blink::WebURLRequest &request) { 57 static bool CorrectAcceptEncoding(const blink::WebURLRequest &request) {
58 std::string value = request.httpHeaderField( 58 std::string value = request.httpHeaderField(
59 WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding)).utf8(); 59 WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding)).utf8();
60 return (value.find("identity;q=1") != std::string::npos) && 60 return (value.find("identity;q=1") != std::string::npos) &&
61 (value.find("*;q=0") != std::string::npos); 61 (value.find("*;q=0") != std::string::npos);
62 } 62 }
63 63
64 class BufferedResourceLoaderTest : public testing::Test { 64 class BufferedResourceLoaderTest : public testing::Test {
65 public: 65 public:
66 BufferedResourceLoaderTest() 66 BufferedResourceLoaderTest()
67 : view_(WebView::create(NULL)), frame_(WebFrame::create(&client_)) { 67 : view_(WebView::create(NULL)), frame_(WebLocalFrame::create(&client_)) {
68 view_->setMainFrame(frame_); 68 view_->setMainFrame(frame_);
69 69
70 for (int i = 0; i < kDataSize; ++i) { 70 for (int i = 0; i < kDataSize; ++i) {
71 data_[i] = i; 71 data_[i] = i;
72 } 72 }
73 } 73 }
74 74
75 virtual ~BufferedResourceLoaderTest() { 75 virtual ~BufferedResourceLoaderTest() {
76 view_->close(); 76 view_->close();
77 frame_->close(); 77 frame_->close();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 protected: 290 protected:
291 GURL gurl_; 291 GURL gurl_;
292 int64 first_position_; 292 int64 first_position_;
293 int64 last_position_; 293 int64 last_position_;
294 294
295 scoped_ptr<BufferedResourceLoader> loader_; 295 scoped_ptr<BufferedResourceLoader> loader_;
296 NiceMock<MockWebURLLoader>* url_loader_; 296 NiceMock<MockWebURLLoader>* url_loader_;
297 297
298 MockWebFrameClient client_; 298 MockWebFrameClient client_;
299 WebView* view_; 299 WebView* view_;
300 WebFrame* frame_; 300 WebLocalFrame* frame_;
301 301
302 base::MessageLoop message_loop_; 302 base::MessageLoop message_loop_;
303 303
304 uint8 data_[kDataSize]; 304 uint8 data_[kDataSize];
305 305
306 private: 306 private:
307 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoaderTest); 307 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoaderTest);
308 }; 308 };
309 309
310 TEST_F(BufferedResourceLoaderTest, StartStop) { 310 TEST_F(BufferedResourceLoaderTest, StartStop) {
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 ExpectContentRangeFailure("bytes 20-10/400"); 1122 ExpectContentRangeFailure("bytes 20-10/400");
1123 1123
1124 ExpectContentRangeSuccess("bytes 0-499/500", 0, 499, 500); 1124 ExpectContentRangeSuccess("bytes 0-499/500", 0, 499, 500);
1125 ExpectContentRangeSuccess("bytes 0-0/500", 0, 0, 500); 1125 ExpectContentRangeSuccess("bytes 0-0/500", 0, 0, 500);
1126 ExpectContentRangeSuccess("bytes 10-11/50", 10, 11, 50); 1126 ExpectContentRangeSuccess("bytes 10-11/50", 10, 11, 50);
1127 ExpectContentRangeSuccess("bytes 10-11/*", 10, 11, 1127 ExpectContentRangeSuccess("bytes 10-11/*", 10, 11,
1128 kPositionNotSpecified); 1128 kPositionNotSpecified);
1129 } 1129 }
1130 1130
1131 } // namespace content 1131 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/buffered_data_source_unittest.cc ('k') | content/renderer/media/renderer_webaudiodevice_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698