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/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 void TearDown() override { | 63 void TearDown() override { |
64 drp_test_context_->DestroySettings(); | 64 drp_test_context_->DestroySettings(); |
65 ChromeRenderViewHostTestHarness::TearDown(); | 65 ChromeRenderViewHostTestHarness::TearDown(); |
66 } | 66 } |
67 | 67 |
68 void SimulateWillProcessResponse() { | 68 void SimulateWillProcessResponse() { |
69 std::string headers = base::StringPrintf( | 69 std::string headers = base::StringPrintf( |
70 "HTTP/1.1 200 OK\n%s: %s\n\n", | 70 "HTTP/1.1 200 OK\n%s: %s\n\n", |
71 data_reduction_proxy::chrome_proxy_header(), | 71 data_reduction_proxy::chrome_proxy_header(), |
72 data_reduction_proxy::chrome_proxy_lo_fi_preview_directive()); | 72 data_reduction_proxy::chrome_proxy_lite_page_directive()); |
73 test_handle_->CallWillProcessResponseForTesting( | 73 test_handle_->CallWillProcessResponseForTesting( |
74 main_rfh(), | 74 main_rfh(), |
75 net::HttpUtil::AssembleRawHeaders(headers.c_str(), headers.size())); | 75 net::HttpUtil::AssembleRawHeaders(headers.c_str(), headers.size())); |
76 test_handle_->CallDidCommitNavigationForTesting(GURL(kTestUrl)); | 76 test_handle_->CallDidCommitNavigationForTesting(GURL(kTestUrl)); |
77 } | 77 } |
78 | 78 |
79 void CallDidFinishNavigation() { test_handle_.reset(); } | 79 void CallDidFinishNavigation() { test_handle_.reset(); } |
80 | 80 |
81 private: | 81 private: |
82 std::unique_ptr<content::NavigationHandle> test_handle_; | 82 std::unique_ptr<content::NavigationHandle> test_handle_; |
(...skipping 12 matching lines...) Expand all Loading... |
95 InfoBarService* infobar_service = | 95 InfoBarService* infobar_service = |
96 InfoBarService::FromWebContents(web_contents()); | 96 InfoBarService::FromWebContents(web_contents()); |
97 EXPECT_EQ(1U, infobar_service->infobar_count()); | 97 EXPECT_EQ(1U, infobar_service->infobar_count()); |
98 EXPECT_TRUE(infobar_tab_helper->displayed_preview_infobar()); | 98 EXPECT_TRUE(infobar_tab_helper->displayed_preview_infobar()); |
99 | 99 |
100 // Navigate to reset the displayed state. | 100 // Navigate to reset the displayed state. |
101 content::WebContentsTester::For(web_contents()) | 101 content::WebContentsTester::For(web_contents()) |
102 ->NavigateAndCommit(GURL(kTestUrl)); | 102 ->NavigateAndCommit(GURL(kTestUrl)); |
103 EXPECT_FALSE(infobar_tab_helper->displayed_preview_infobar()); | 103 EXPECT_FALSE(infobar_tab_helper->displayed_preview_infobar()); |
104 } | 104 } |
OLD | NEW |