| OLD | NEW |
| 1 // Copyright (c) 2011 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 #include "chrome_frame/test/mock_ie_event_sink_actions.h" | 5 #include "chrome_frame/test/mock_ie_event_sink_actions.h" |
| 6 #include "chrome_frame/test/mock_ie_event_sink_test.h" | 6 #include "chrome_frame/test/mock_ie_event_sink_test.h" |
| 7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
| 8 | 8 |
| 9 namespace chrome_frame_test { | 9 namespace chrome_frame_test { |
| 10 | 10 |
| 11 class TestData { | 11 class TestData { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 32 void ExpectOnServer(MockWebServer* server_mock) const { | 32 void ExpectOnServer(MockWebServer* server_mock) const { |
| 33 EXPECT_CALL(*server_mock, Get(testing::_, GetPath(), testing::_)) | 33 EXPECT_CALL(*server_mock, Get(testing::_, GetPath(), testing::_)) |
| 34 .Times(testing::AnyNumber()) | 34 .Times(testing::AnyNumber()) |
| 35 .WillRepeatedly(SendFast(GetHeaders(), GetHtml())); | 35 .WillRepeatedly(SendFast(GetHeaders(), GetHtml())); |
| 36 } | 36 } |
| 37 | 37 |
| 38 std::string GetHeaders() const { | 38 std::string GetHeaders() const { |
| 39 std::ostringstream headers; | 39 std::ostringstream headers; |
| 40 headers << "HTTP/1.1 200 OK\r\n" | 40 headers << "HTTP/1.1 200 OK\r\n" |
| 41 << "Connection: close\r\n" | 41 << "Connection: close\r\n" |
| 42 << "Content-Type: text/html\r\n"; | 42 << "Content-Type: text/html\r\n" |
| 43 << "Cache-Control: no-cache\r\n"; |
| 43 if (in_header_) { | 44 if (in_header_) { |
| 44 headers << "X-UA-COMPATIBLE: " << value_ << "\r\n"; | 45 headers << "X-UA-COMPATIBLE: " << value_ << "\r\n"; |
| 45 } | 46 } |
| 46 return headers.str(); | 47 return headers.str(); |
| 47 } | 48 } |
| 48 | 49 |
| 49 std::string GetHtml() const { | 50 std::string GetHtml() const { |
| 50 std::ostringstream html; | 51 std::ostringstream html; |
| 51 html << "<html><head>"; | 52 html << "<html><head>"; |
| 52 if (!in_header_) { | 53 if (!in_header_) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 GetParam().ExpectOnServer(&server_mock_); | 178 GetParam().ExpectOnServer(&server_mock_); |
| 178 ie_mock_.ExpectNavigation(expected_renderer, url); | 179 ie_mock_.ExpectNavigation(expected_renderer, url); |
| 179 | 180 |
| 180 EXPECT_CALL(ie_mock_, OnLoad(expected_renderer, testing::StrEq(url))) | 181 EXPECT_CALL(ie_mock_, OnLoad(expected_renderer, testing::StrEq(url))) |
| 181 .WillOnce(CloseBrowserMock(&ie_mock_)); | 182 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 182 | 183 |
| 183 LaunchIEAndNavigate(url); | 184 LaunchIEAndNavigate(url); |
| 184 } | 185 } |
| 185 | 186 |
| 186 } // namespace chrome_frame_test | 187 } // namespace chrome_frame_test |
| OLD | NEW |