OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/http/http_util.h" | 10 #include "net/http/http_util.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 class BufferedResourceLoaderTest : public testing::Test { | 67 class BufferedResourceLoaderTest : public testing::Test { |
68 public: | 68 public: |
69 BufferedResourceLoaderTest() { | 69 BufferedResourceLoaderTest() { |
70 url_loader_ = new NiceMock<MockWebURLLoader>(); | 70 url_loader_ = new NiceMock<MockWebURLLoader>(); |
71 | 71 |
72 for (int i = 0; i < kDataSize; ++i) | 72 for (int i = 0; i < kDataSize; ++i) |
73 data_[i] = i; | 73 data_[i] = i; |
74 } | 74 } |
75 | 75 |
76 virtual ~BufferedResourceLoaderTest() { | 76 virtual ~BufferedResourceLoaderTest() { |
77 ignore_result(frame_.release()); | |
78 } | 77 } |
79 | 78 |
80 void Initialize(const char* url, int first_position, int last_position) { | 79 void Initialize(const char* url, int first_position, int last_position) { |
81 gurl_ = GURL(url); | 80 gurl_ = GURL(url); |
82 first_position_ = first_position; | 81 first_position_ = first_position; |
83 last_position_ = last_position; | 82 last_position_ = last_position; |
84 | 83 |
85 frame_.reset(new NiceMock<MockWebFrame>()); | 84 frame_.reset(new NiceMock<MockWebFrame>()); |
86 | 85 |
87 loader_ = new BufferedResourceLoader(gurl_, | 86 loader_ = new BufferedResourceLoader(gurl_, |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 WriteLoader(70, 40); | 475 WriteLoader(70, 40); |
477 AllowLoaderDefer(); | 476 AllowLoaderDefer(); |
478 | 477 |
479 EXPECT_CALL(*this, ReadCallback(net::ERR_CACHE_MISS)); | 478 EXPECT_CALL(*this, ReadCallback(net::ERR_CACHE_MISS)); |
480 ReadLoader(20, 5, buffer); | 479 ReadLoader(20, 5, buffer); |
481 StopWhenLoad(); | 480 StopWhenLoad(); |
482 } | 481 } |
483 // TODO(hclam): add unit test for defer loading. | 482 // TODO(hclam): add unit test for defer loading. |
484 | 483 |
485 } // namespace webkit_glue | 484 } // namespace webkit_glue |
486 | |
OLD | NEW |