Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: chrome/browser/plugins/flash_download_interception_unittest.cc

Issue 2811903002: [HBD] Tighten-up which adobe.com/go links are intercepted as Flash URLs (Closed)
Patch Set: fix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/plugins/flash_download_interception.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/",
47 "http://get.adobe.com/flash", 47 "http://get.adobe.com/flash",
48 "http://get.adobe.com/fr/flashplayer/", 48 "http://get.adobe.com/fr/flashplayer/",
49 "http://get.adobe.com/flashplayer", 49 "http://get.adobe.com/flashplayer",
50 "http://macromedia.com/go/getflashplayer", 50 "http://macromedia.com/go/getflashplayer",
51 "http://adobe.com/go/getflashplayer", 51 "http://adobe.com/go/getflashplayer",
52 "http://adobe.com/go/CA-H-GET-FLASH",
53 "http://adobe.com/go/DE_CH-H-M-A2",
52 "http://adobe.com/go/gntray_dl_getflashplayer_jp", 54 "http://adobe.com/go/gntray_dl_getflashplayer_jp",
53 }; 55 };
54 56
55 for (auto* url : flash_intercept_urls) { 57 for (auto* url : flash_intercept_urls) {
56 EXPECT_TRUE(ShouldStopFlashDownloadAction(url)) 58 EXPECT_TRUE(ShouldStopFlashDownloadAction(url))
57 << "Should have intercepted: " << url; 59 << "Should have intercepted: " << url;
58 } 60 }
59 61
60 const char* flash_no_intercept_urls[] = { 62 const char* flash_no_intercept_urls[] = {
61 "https://www.example.com", 63 "https://www.example.com", "http://example.com/get.adobe.com/flashplayer",
62 "http://example.com/get.adobe.com/flashplayer",
63 "http://ww.macromedia.com/go/getflashplayer", 64 "http://ww.macromedia.com/go/getflashplayer",
64 "http://wwwxmacromedia.com/go/getflashplayer", 65 "http://wwwxmacromedia.com/go/getflashplayer",
65 "http://www.adobe.com/software/flash/about/", 66 "http://www.adobe.com/software/flash/about/",
66 "http://www.adobe.com/products/flashplayer.html", 67 "http://www.adobe.com/products/flashplayer.html",
67 "http://www.adobe.com/products/flashruntimes.html", 68 "http://www.adobe.com/products/flashruntimes.html",
68 "http://www.adobe.com/go/flash", 69 "http://www.adobe.com/go/flash",
70 // Don't intercept URLs containing just "fp" without a matching prefix.
71 "http://www.adobe.com/go/non-matching-prefix-fp",
72 // Don't match text within the query or fragment.
73 "http://www.adobe.com/go/non-matching?foo=flashplayer",
74 "http://www.adobe.com/go/non-matching#!foo=flashplayer",
69 }; 75 };
70 76
71 for (auto* url : flash_no_intercept_urls) { 77 for (auto* url : flash_no_intercept_urls) {
72 EXPECT_FALSE(ShouldStopFlashDownloadAction(url)) 78 EXPECT_FALSE(ShouldStopFlashDownloadAction(url))
73 << "Should not have intercepted: " << url; 79 << "Should not have intercepted: " << url;
74 } 80 }
75 81
76 // Don't intercept navigations occurring on the flash download page. 82 // Don't intercept navigations occurring on the flash download page.
77 EXPECT_FALSE(FlashDownloadInterception::ShouldStopFlashDownloadAction( 83 EXPECT_FALSE(FlashDownloadInterception::ShouldStopFlashDownloadAction(
78 host_content_settings_map(), GURL("https://get.adobe.com/flashplayer/"), 84 host_content_settings_map(), GURL("https://get.adobe.com/flashplayer/"),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Intercept on both explicit DETECT and BLOCK. 124 // Intercept on both explicit DETECT and BLOCK.
119 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, 125 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
120 CONTENT_SETTING_BLOCK); 126 CONTENT_SETTING_BLOCK);
121 EXPECT_TRUE( 127 EXPECT_TRUE(
122 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); 128 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/"));
123 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, 129 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
124 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); 130 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT);
125 EXPECT_TRUE( 131 EXPECT_TRUE(
126 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); 132 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/"));
127 } 133 }
OLDNEW
« no previous file with comments | « chrome/browser/plugins/flash_download_interception.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698