| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 #if BUILDFLAG(ANDROID_JAVA_UI) | 124 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 125 TEST_F(PreviewsInfoBarTabHelperUnitTest, CreateOfflineInfoBar) { | 125 TEST_F(PreviewsInfoBarTabHelperUnitTest, CreateOfflineInfoBar) { |
| 126 PreviewsInfoBarTabHelper* infobar_tab_helper = | 126 PreviewsInfoBarTabHelper* infobar_tab_helper = |
| 127 PreviewsInfoBarTabHelper::FromWebContents(web_contents()); | 127 PreviewsInfoBarTabHelper::FromWebContents(web_contents()); |
| 128 EXPECT_FALSE(infobar_tab_helper->displayed_preview_infobar()); | 128 EXPECT_FALSE(infobar_tab_helper->displayed_preview_infobar()); |
| 129 | 129 |
| 130 SimulateCommit(); | 130 SimulateCommit(); |
| 131 offline_pages::OfflinePageItem item; | 131 offline_pages::OfflinePageItem item; |
| 132 item.url = GURL(kTestUrl); |
| 132 offline_pages::OfflinePageHeader header; | 133 offline_pages::OfflinePageHeader header; |
| 133 offline_pages::OfflinePageTabHelper::FromWebContents(web_contents()) | 134 offline_pages::OfflinePageTabHelper::FromWebContents(web_contents()) |
| 134 ->SetOfflinePage(item, header, true); | 135 ->SetOfflinePage(item, header, true); |
| 135 CallDidFinishNavigation(); | 136 CallDidFinishNavigation(); |
| 136 | 137 |
| 137 InfoBarService* infobar_service = | 138 InfoBarService* infobar_service = |
| 138 InfoBarService::FromWebContents(web_contents()); | 139 InfoBarService::FromWebContents(web_contents()); |
| 139 EXPECT_EQ(1U, infobar_service->infobar_count()); | 140 EXPECT_EQ(1U, infobar_service->infobar_count()); |
| 140 EXPECT_TRUE(infobar_tab_helper->displayed_preview_infobar()); | 141 EXPECT_TRUE(infobar_tab_helper->displayed_preview_infobar()); |
| 141 | 142 |
| 142 // Navigate to reset the displayed state. | 143 // Navigate to reset the displayed state. |
| 143 content::WebContentsTester::For(web_contents()) | 144 content::WebContentsTester::For(web_contents()) |
| 144 ->NavigateAndCommit(GURL(kTestUrl)); | 145 ->NavigateAndCommit(GURL(kTestUrl)); |
| 145 | 146 |
| 146 EXPECT_FALSE(infobar_tab_helper->displayed_preview_infobar()); | 147 EXPECT_FALSE(infobar_tab_helper->displayed_preview_infobar()); |
| 147 } | 148 } |
| 148 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 149 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| OLD | NEW |