OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ | 5 #ifndef CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ |
6 #define CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ | 6 #define CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // Invoked when a MockWebServer receives an expected response; see | 55 // Invoked when a MockWebServer receives an expected response; see |
56 // MockWebServer::ExpectAndHandlePostedResult. | 56 // MockWebServer::ExpectAndHandlePostedResult. |
57 virtual void OnExpectedResponse() = 0; | 57 virtual void OnExpectedResponse() = 0; |
58 }; | 58 }; |
59 | 59 |
60 // Simple Gmock friendly web server. Sample usage: | 60 // Simple Gmock friendly web server. Sample usage: |
61 // MockWebServer mock(9999, "0.0.0.0"); | 61 // MockWebServer mock(9999, "0.0.0.0"); |
62 // EXPECT_CALL(mock, Get(_, StrEq("/favicon.ico"), _)).WillRepeatedly(SendFast( | 62 // EXPECT_CALL(mock, Get(_, StrEq("/favicon.ico"), _)).WillRepeatedly(SendFast( |
63 // "HTTP/1.1 404 Not Found" | 63 // "HTTP/1.1 404 Not Found" |
64 // "text/html; charset=UTF-8", EmptyString())); | 64 // "text/html; charset=UTF-8", std::string())); |
65 // | 65 // |
66 // EXPECT_CALL(mock, Get(_, StrEq("/book"), _)).WillRepeatedly(Send( | 66 // EXPECT_CALL(mock, Get(_, StrEq("/book"), _)).WillRepeatedly(Send( |
67 // "HTTP/1.1 302 Found\r\n" | 67 // "HTTP/1.1 302 Found\r\n" |
68 // "Connection: close\r\n" | 68 // "Connection: close\r\n" |
69 // "Content-Type: text/html\r\n" | 69 // "Content-Type: text/html\r\n" |
70 // "Location: library\r\n", | 70 // "Location: library\r\n", |
71 // "<html>Lalalala</html>", 3, 1000)); | 71 // "<html>Lalalala</html>", 3, 1000)); |
72 // | 72 // |
73 // EXPECT_CALL(mock, Get(_, StrEq("/library"), _)).WillRepeatedly(Send( | 73 // EXPECT_CALL(mock, Get(_, StrEq("/library"), _)).WillRepeatedly(Send( |
74 // "HTTP/1.1 200 OK\r\n" | 74 // "HTTP/1.1 200 OK\r\n" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 // Same as above except that the response does not include the no-cache header. | 363 // Same as above except that the response does not include the no-cache header. |
364 ACTION_P2(SendAllowCacheResponse, server, invocation) { | 364 ACTION_P2(SendAllowCacheResponse, server, invocation) { |
365 server->SendResponseHelper(arg0, arg1, invocation, false); | 365 server->SendResponseHelper(arg0, arg1, invocation, false); |
366 } | 366 } |
367 | 367 |
368 ACTION_P2(HandlePostedResponseHelper, server, invocation) { | 368 ACTION_P2(HandlePostedResponseHelper, server, invocation) { |
369 server->HandlePostedResponse(arg0, arg2); | 369 server->HandlePostedResponse(arg0, arg2); |
370 } | 370 } |
371 | 371 |
372 #endif // CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ | 372 #endif // CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ |
OLD | NEW |