OLD | NEW |
1 // Copyright (c) 2010 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 <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" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
(...skipping 19 matching lines...) Expand all Loading... |
31 using ::testing::SetArgumentPointee; | 31 using ::testing::SetArgumentPointee; |
32 using ::testing::StrictMock; | 32 using ::testing::StrictMock; |
33 using ::testing::NiceMock; | 33 using ::testing::NiceMock; |
34 using ::testing::WithArgs; | 34 using ::testing::WithArgs; |
35 | 35 |
36 using WebKit::WebURLError; | 36 using WebKit::WebURLError; |
37 using WebKit::WebFrameClient; | 37 using WebKit::WebFrameClient; |
38 using WebKit::WebURLResponse; | 38 using WebKit::WebURLResponse; |
39 using WebKit::WebView; | 39 using WebKit::WebView; |
40 | 40 |
41 namespace { | 41 namespace webkit_glue { |
42 | 42 |
43 const char* kHttpUrl = "http://test"; | 43 static const char* kHttpUrl = "http://test"; |
44 const char kHttpRedirectToSameDomainUrl1[] = "http://test/ing"; | 44 static const char kHttpRedirectToSameDomainUrl1[] = "http://test/ing"; |
45 const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; | 45 static const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; |
46 const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; | 46 static const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; |
47 const char kHttpRedirectToDifferentDomainUrl2[] = "http://test2/ing"; | 47 static const char kHttpRedirectToDifferentDomainUrl2[] = "http://test2/ing"; |
48 | 48 |
49 const int kDataSize = 1024; | 49 static const int kDataSize = 1024; |
50 const int kHttpOK = 200; | 50 static const int kHttpOK = 200; |
51 const int kHttpPartialContent = 206; | 51 static const int kHttpPartialContent = 206; |
52 | 52 |
53 enum NetworkState { | 53 enum NetworkState { |
54 NONE, | 54 NONE, |
55 LOADED, | 55 LOADED, |
56 LOADING | 56 LOADING |
57 }; | 57 }; |
58 | 58 |
59 } // namespace | |
60 | |
61 namespace webkit_glue { | |
62 | |
63 // Submit a request completed event to the resource loader due to request | 59 // Submit a request completed event to the resource loader due to request |
64 // being canceled. Pretending the event is from external. | 60 // being canceled. Pretending the event is from external. |
65 ACTION_P(RequestCanceled, loader) { | 61 ACTION_P(RequestCanceled, loader) { |
66 WebURLError error; | 62 WebURLError error; |
67 error.reason = net::ERR_ABORTED; | 63 error.reason = net::ERR_ABORTED; |
68 error.domain = WebString::fromUTF8(net::kErrorDomain); | 64 error.domain = WebString::fromUTF8(net::kErrorDomain); |
69 loader->didFail(NULL, error); | 65 loader->didFail(NULL, error); |
70 } | 66 } |
71 | 67 |
72 class BufferedResourceLoaderTest : public testing::Test { | 68 class BufferedResourceLoaderTest : public testing::Test { |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 Start(); | 531 Start(); |
536 Redirect(kHttpRedirectToSameDomainUrl1); | 532 Redirect(kHttpRedirectToSameDomainUrl1); |
537 Redirect(kHttpRedirectToDifferentDomainUrl1); | 533 Redirect(kHttpRedirectToDifferentDomainUrl1); |
538 EXPECT_FALSE(loader_->HasSingleOrigin()); | 534 EXPECT_FALSE(loader_->HasSingleOrigin()); |
539 StopWhenLoad(); | 535 StopWhenLoad(); |
540 } | 536 } |
541 | 537 |
542 // TODO(hclam): add unit test for defer loading. | 538 // TODO(hclam): add unit test for defer loading. |
543 | 539 |
544 } // namespace webkit_glue | 540 } // namespace webkit_glue |
OLD | NEW |