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/plugins/flash_download_interception.h" | 5 #include "chrome/browser/plugins/flash_download_interception.h" |
6 | 6 |
7 #include "base/test/scoped_feature_list.h" | 7 #include "base/test/scoped_feature_list.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
9 #include "chrome/common/chrome_features.h" | 9 #include "chrome/common/chrome_features.h" |
10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 host_content_settings_map(), GURL("http://source-page.com"), | 66 host_content_settings_map(), GURL("http://source-page.com"), |
67 GURL("https://www.example.com"), true)); | 67 GURL("https://www.example.com"), true)); |
68 | 68 |
69 EXPECT_FALSE(FlashDownloadInterception::ShouldStopFlashDownloadAction( | 69 EXPECT_FALSE(FlashDownloadInterception::ShouldStopFlashDownloadAction( |
70 host_content_settings_map(), GURL("http://source-page.com"), | 70 host_content_settings_map(), GURL("http://source-page.com"), |
71 GURL("http://example.com/get.adobe.com/flashplayer"), true)); | 71 GURL("http://example.com/get.adobe.com/flashplayer"), true)); |
72 | 72 |
73 EXPECT_FALSE(FlashDownloadInterception::ShouldStopFlashDownloadAction( | 73 EXPECT_FALSE(FlashDownloadInterception::ShouldStopFlashDownloadAction( |
74 host_content_settings_map(), GURL("http://source-page.com"), | 74 host_content_settings_map(), GURL("http://source-page.com"), |
75 GURL("http://ww.macromedia.com/go/getflashplayer"), true)); | 75 GURL("http://ww.macromedia.com/go/getflashplayer"), true)); |
| 76 |
| 77 // Don't intercept navigations occurring on the flash download page. |
| 78 EXPECT_FALSE(FlashDownloadInterception::ShouldStopFlashDownloadAction( |
| 79 host_content_settings_map(), GURL("https://get.adobe.com/flashplayer/"), |
| 80 GURL("https://get.adobe.com/flashplayer/"), true)); |
76 } | 81 } |
77 | 82 |
78 TEST_F(FlashDownloadInterceptionTest, NavigationThrottleCancelsNavigation) { | 83 TEST_F(FlashDownloadInterceptionTest, NavigationThrottleCancelsNavigation) { |
79 base::test::ScopedFeatureList feature_list; | 84 base::test::ScopedFeatureList feature_list; |
80 feature_list.InitAndEnableFeature(features::kPreferHtmlOverPlugins); | 85 feature_list.InitAndEnableFeature(features::kPreferHtmlOverPlugins); |
81 | 86 |
82 // Set the source URL to an HTTP source. | 87 // Set the source URL to an HTTP source. |
83 NavigateAndCommit(GURL("http://example.com")); | 88 NavigateAndCommit(GURL("http://example.com")); |
84 | 89 |
85 std::unique_ptr<NavigationHandle> handle = | 90 std::unique_ptr<NavigationHandle> handle = |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 CONTENT_SETTING_BLOCK); | 123 CONTENT_SETTING_BLOCK); |
119 EXPECT_TRUE(FlashDownloadInterception::ShouldStopFlashDownloadAction( | 124 EXPECT_TRUE(FlashDownloadInterception::ShouldStopFlashDownloadAction( |
120 host_content_settings_map(), GURL("http://source-page.com"), | 125 host_content_settings_map(), GURL("http://source-page.com"), |
121 GURL("https://get.adobe.com/flashplayer/"), true)); | 126 GURL("https://get.adobe.com/flashplayer/"), true)); |
122 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 127 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
123 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); | 128 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); |
124 EXPECT_TRUE(FlashDownloadInterception::ShouldStopFlashDownloadAction( | 129 EXPECT_TRUE(FlashDownloadInterception::ShouldStopFlashDownloadAction( |
125 host_content_settings_map(), GURL("http://source-page.com"), | 130 host_content_settings_map(), GURL("http://source-page.com"), |
126 GURL("https://get.adobe.com/flashplayer/"), true)); | 131 GURL("https://get.adobe.com/flashplayer/"), true)); |
127 } | 132 } |
OLD | NEW |