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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 TEST_F(FlashDownloadInterceptionTest, NavigationThrottleCancelsNavigation) { | 82 TEST_F(FlashDownloadInterceptionTest, NavigationThrottleCancelsNavigation) { |
83 base::test::ScopedFeatureList feature_list; | 83 base::test::ScopedFeatureList feature_list; |
84 feature_list.InitAndEnableFeature(features::kPreferHtmlOverPlugins); | 84 feature_list.InitAndEnableFeature(features::kPreferHtmlOverPlugins); |
85 | 85 |
86 // Set the source URL to an HTTP source. | 86 // Set the source URL to an HTTP source. |
87 NavigateAndCommit(GURL("http://example.com")); | 87 NavigateAndCommit(GURL("http://example.com")); |
88 | 88 |
89 std::unique_ptr<NavigationHandle> handle = | 89 std::unique_ptr<NavigationHandle> handle = |
90 NavigationHandle::CreateNavigationHandleForTesting( | 90 NavigationHandle::CreateNavigationHandleForTesting( |
91 GURL("https://get.adobe.com/flashplayer"), main_rfh(), | 91 GURL("https://get.adobe.com/flashplayer"), main_rfh(), |
92 false /* committed */, net::OK, true /* has_user_gesture */); | 92 false /* committed */, net::OK, content::NavigationGestureUser); |
93 | 93 |
94 handle->CallWillStartRequestForTesting(true, content::Referrer(), | 94 handle->CallWillStartRequestForTesting(true, content::Referrer(), |
95 ui::PAGE_TRANSITION_LINK, false); | 95 ui::PAGE_TRANSITION_LINK, false); |
96 std::unique_ptr<NavigationThrottle> throttle = | 96 std::unique_ptr<NavigationThrottle> throttle = |
97 FlashDownloadInterception::MaybeCreateThrottleFor(handle.get()); | 97 FlashDownloadInterception::MaybeCreateThrottleFor(handle.get()); |
98 EXPECT_NE(nullptr, throttle); | 98 EXPECT_NE(nullptr, throttle); |
99 ASSERT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, | 99 ASSERT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, |
100 throttle->WillStartRequest()); | 100 throttle->WillStartRequest()); |
101 } | 101 } |
102 | 102 |
(...skipping 16 matching lines...) Expand all Loading... |
119 // Intercept on both explicit DETECT and BLOCK. | 119 // Intercept on both explicit DETECT and BLOCK. |
120 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 120 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
121 CONTENT_SETTING_BLOCK); | 121 CONTENT_SETTING_BLOCK); |
122 EXPECT_TRUE( | 122 EXPECT_TRUE( |
123 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); | 123 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); |
124 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 124 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
125 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); | 125 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); |
126 EXPECT_TRUE( | 126 EXPECT_TRUE( |
127 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); | 127 ShouldStopFlashDownloadAction("https://get.adobe.com/flashplayer/")); |
128 } | 128 } |
OLD | NEW |