OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/previews/previews_infobar_tab_helper.h" | 5 #include "chrome/browser/previews/previews_infobar_tab_helper.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 ChromeRenderViewHostTestHarness::TearDown(); | 79 ChromeRenderViewHostTestHarness::TearDown(); |
80 } | 80 } |
81 | 81 |
82 void SimulateWillProcessResponse() { | 82 void SimulateWillProcessResponse() { |
83 std::string headers = base::StringPrintf( | 83 std::string headers = base::StringPrintf( |
84 "HTTP/1.1 200 OK\n%s: %s\n\n", | 84 "HTTP/1.1 200 OK\n%s: %s\n\n", |
85 data_reduction_proxy::chrome_proxy_content_transform_header(), | 85 data_reduction_proxy::chrome_proxy_content_transform_header(), |
86 data_reduction_proxy::lite_page_directive()); | 86 data_reduction_proxy::lite_page_directive()); |
87 test_handle_->CallWillProcessResponseForTesting( | 87 test_handle_->CallWillProcessResponseForTesting( |
88 main_rfh(), | 88 main_rfh(), |
89 net::HttpUtil::AssembleRawHeaders(headers.c_str(), headers.size())); | 89 net::HttpUtil::AssembleRawHeaders(headers.c_str(), headers.size()), |
| 90 content::NavigationHandle::ThrottleChecksFinishedCallback()); |
90 SimulateCommit(); | 91 SimulateCommit(); |
91 } | 92 } |
92 | 93 |
93 void SimulateCommit() { | 94 void SimulateCommit() { |
94 test_handle_->CallDidCommitNavigationForTesting(GURL(kTestUrl)); | 95 test_handle_->CallDidCommitNavigationForTesting(GURL(kTestUrl)); |
95 } | 96 } |
96 | 97 |
97 void CallDidFinishNavigation() { test_handle_.reset(); } | 98 void CallDidFinishNavigation() { test_handle_.reset(); } |
98 | 99 |
99 private: | 100 private: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 EXPECT_EQ(1U, infobar_service->infobar_count()); | 142 EXPECT_EQ(1U, infobar_service->infobar_count()); |
142 EXPECT_TRUE(infobar_tab_helper->displayed_preview_infobar()); | 143 EXPECT_TRUE(infobar_tab_helper->displayed_preview_infobar()); |
143 | 144 |
144 // Navigate to reset the displayed state. | 145 // Navigate to reset the displayed state. |
145 content::WebContentsTester::For(web_contents()) | 146 content::WebContentsTester::For(web_contents()) |
146 ->NavigateAndCommit(GURL(kTestUrl)); | 147 ->NavigateAndCommit(GURL(kTestUrl)); |
147 | 148 |
148 EXPECT_FALSE(infobar_tab_helper->displayed_preview_infobar()); | 149 EXPECT_FALSE(infobar_tab_helper->displayed_preview_infobar()); |
149 } | 150 } |
150 #endif // defined(OS_ANDROID) | 151 #endif // defined(OS_ANDROID) |
OLD | NEW |