| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 EXPECT_FALSE( | 37 EXPECT_FALSE( |
| 38 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); | 38 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); |
| 39 } | 39 } |
| 40 | 40 |
| 41 TEST_F(FlashDownloadInterceptionTest, DownloadUrlVariations) { | 41 TEST_F(FlashDownloadInterceptionTest, DownloadUrlVariations) { |
| 42 base::test::ScopedFeatureList feature_list; | 42 base::test::ScopedFeatureList feature_list; |
| 43 feature_list.InitAndEnableFeature(features::kPreferHtmlOverPlugins); | 43 feature_list.InitAndEnableFeature(features::kPreferHtmlOverPlugins); |
| 44 | 44 |
| 45 const char* flash_intercept_urls[] = { | 45 const char* flash_intercept_urls[] = { |
| 46 "https://get.adobe.com/flashplayer/", | 46 "https://get.adobe.com/flashplayer/", "http://get.adobe.com/flash", |
| 47 "http://get.adobe.com/flash", | |
| 48 "http://get.adobe.com/fr/flashplayer/", | 47 "http://get.adobe.com/fr/flashplayer/", |
| 49 "http://get.adobe.com/flashplayer", | 48 "http://get.adobe.com/flashplayer", |
| 50 "http://macromedia.com/go/getflashplayer", | 49 "http://macromedia.com/go/getflashplayer", |
| 51 "http://adobe.com/go/getflashplayer", | 50 "http://adobe.com/go/getflashplayer", |
| 52 "http://adobe.com/go/gntray_dl_getflashplayer_jp", | 51 "http://adobe.com/go/gntray_dl_getflashplayer_jp", |
| 52 "http://www.adobe.com/shockwave/download/" |
| 53 "download.cgi?P1_Prod_Version=ShockwaveFlash", |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 for (auto* url : flash_intercept_urls) { | 56 for (auto* url : flash_intercept_urls) { |
| 56 EXPECT_TRUE(ShouldStopFlashDownloadAction(url)) | 57 EXPECT_TRUE(ShouldStopFlashDownloadAction(url)) |
| 57 << "Should have intercepted: " << url; | 58 << "Should have intercepted: " << url; |
| 58 } | 59 } |
| 59 | 60 |
| 60 const char* flash_no_intercept_urls[] = { | 61 const char* flash_no_intercept_urls[] = { |
| 61 "https://www.example.com", | 62 "https://www.example.com", |
| 62 "http://example.com/get.adobe.com/flashplayer", | 63 "http://example.com/get.adobe.com/flashplayer", |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // Intercept on both explicit DETECT and BLOCK. | 119 // Intercept on both explicit DETECT and BLOCK. |
| 119 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 120 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
| 120 CONTENT_SETTING_BLOCK); | 121 CONTENT_SETTING_BLOCK); |
| 121 EXPECT_TRUE( | 122 EXPECT_TRUE( |
| 122 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); | 123 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); |
| 123 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 124 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
| 124 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); | 125 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); |
| 125 EXPECT_TRUE( | 126 EXPECT_TRUE( |
| 126 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); | 127 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); |
| 127 } | 128 } |
| OLD | NEW |