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

Side by Side Diff: chrome_frame/test/url_request_test.cc

Issue 1186002: Adding support for HEAD requests.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 9 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
« no previous file with comments | « no previous file | chrome_frame/urlmon_url_request.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <atlbase.h> 4 #include <atlbase.h>
5 #include <atlcom.h> 5 #include <atlcom.h>
6 #include "app/win_util.h" 6 #include "app/win_util.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gmock_mutant.h" 9 #include "testing/gmock_mutant.h"
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 EXPECT_CALL(mock, OnResponseEnd(1, testing::_)) 78 EXPECT_CALL(mock, OnResponseEnd(1, testing::_))
79 .Times(1) 79 .Times(1)
80 .WillOnce(QUIT_LOOP_SOON(loop, 2)); 80 .WillOnce(QUIT_LOOP_SOON(loop, 2));
81 81
82 request.Start(); 82 request.Start();
83 loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); 83 loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds);
84 request.Release(); 84 request.Release();
85 server.TearDown(); 85 server.TearDown();
86 } 86 }
87 87
88 // Same as Simple1 except we use the HEAD verb to fetch only the headers
89 // from the server.
90 TEST(UrlmonUrlRequestTest, Head) {
91 MockUrlDelegate mock;
92 ChromeFrameHTTPServer server;
93 chrome_frame_test::TimedMsgLoop loop;
94 win_util::ScopedCOMInitializer init_com;
95 CComObjectStackEx<UrlmonUrlRequest> request;
96
97 server.SetUp();
98 request.AddRef();
99 request.Initialize(&mock, 1, // request_id
100 server.Resolve(L"files/chrome_frame_window_open.html").spec(),
101 "head",
102 "", // referrer
103 "", // extra request
104 NULL, // upload data
105 true); // frame busting
106
107 testing::InSequence s;
108 EXPECT_CALL(mock, OnResponseStarted(1, testing::_, testing::_, testing::_,
109 testing::_, testing::_, testing::_))
110 .Times(1)
111 .WillOnce(testing::IgnoreResult(testing::InvokeWithoutArgs(CreateFunctor(
112 &request, &UrlmonUrlRequest::Read, 512))));
113
114
115 // For HEAD requests we don't expect content reads.
116 EXPECT_CALL(mock, OnReadComplete(1, testing::_, testing::_)).Times(0);
117
118 EXPECT_CALL(mock, OnResponseEnd(1, testing::_))
119 .Times(1)
120 .WillOnce(QUIT_LOOP_SOON(loop, 2));
121
122 request.Start();
123 loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds);
124 request.Release();
125 server.TearDown();
126 }
127
88 TEST(UrlmonUrlRequestTest, UnreachableUrl) { 128 TEST(UrlmonUrlRequestTest, UnreachableUrl) {
89 MockUrlDelegate mock; 129 MockUrlDelegate mock;
90 chrome_frame_test::TimedMsgLoop loop; 130 chrome_frame_test::TimedMsgLoop loop;
91 win_util::ScopedCOMInitializer init_com; 131 win_util::ScopedCOMInitializer init_com;
92 CComObjectStackEx<UrlmonUrlRequest> request; 132 CComObjectStackEx<UrlmonUrlRequest> request;
93 ChromeFrameHTTPServer server; 133 ChromeFrameHTTPServer server;
94 server.SetUp(); 134 server.SetUp();
95 GURL unreachable = server.Resolve(L"files/non_existing.html"); 135 GURL unreachable = server.Resolve(L"files/non_existing.html");
96 server.TearDown(); 136 server.TearDown();
97 137
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 EXPECT_CALL(mock, OnResponseEnd(1, testing::_)) 250 EXPECT_CALL(mock, OnResponseEnd(1, testing::_))
211 .Times(1) 251 .Times(1)
212 .WillOnce(QUIT_LOOP_SOON(loop, 2)); 252 .WillOnce(QUIT_LOOP_SOON(loop, 2));
213 253
214 mgr->StartUrlRequest(0, 1, r1); 254 mgr->StartUrlRequest(0, 1, r1);
215 loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); 255 loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds);
216 mgr.reset(); 256 mgr.reset();
217 server.TearDown(); 257 server.TearDown();
218 } 258 }
219 259
OLDNEW
« no previous file with comments | « no previous file | chrome_frame/urlmon_url_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698