Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <deque> | 6 #include <deque> |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1341 // Checks that the prerendering of a page is canceled correctly when a | 1341 // Checks that the prerendering of a page is canceled correctly when a |
| 1342 // Javascript alert is called. | 1342 // Javascript alert is called. |
| 1343 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderAlertAfterOnload) { | 1343 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderAlertAfterOnload) { |
| 1344 PrerenderTestURL("/prerender/prerender_alert_after_onload.html", | 1344 PrerenderTestURL("/prerender/prerender_alert_after_onload.html", |
| 1345 FINAL_STATUS_JAVASCRIPT_ALERT, 1); | 1345 FINAL_STATUS_JAVASCRIPT_ALERT, 1); |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 // Checks that plugins are not loaded while a page is being preloaded, but | 1348 // Checks that plugins are not loaded while a page is being preloaded, but |
| 1349 // are loaded when the page is displayed. | 1349 // are loaded when the page is displayed. |
| 1350 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDelayLoadPlugin) { | 1350 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDelayLoadPlugin) { |
| 1351 HostContentSettingsMap* content_settings_map = | |
| 1352 HostContentSettingsMapFactory::GetForProfile( | |
| 1353 current_browser()->profile()); | |
| 1354 content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | |
| 1355 CONTENT_SETTING_ALLOW); | |
| 1356 | |
| 1351 PrerenderTestURL("/prerender/prerender_plugin_delay_load.html", | 1357 PrerenderTestURL("/prerender/prerender_plugin_delay_load.html", |
| 1352 FINAL_STATUS_USED, 1); | 1358 FINAL_STATUS_USED, 1); |
| 1353 NavigateToDestURL(); | 1359 NavigateToDestURL(); |
| 1354 } | 1360 } |
| 1355 | 1361 |
| 1356 // TODO(tommycli): Remove once we implement Plugin Power Saver on ALLOW. | |
| 1357 // See crbug.com/649814 | |
| 1358 class PrerenderBrowserTestWithPluginPowerSaver : public PrerenderBrowserTest { | |
| 1359 public: | |
| 1360 PrerenderBrowserTestWithPluginPowerSaver() {} | |
| 1361 ~PrerenderBrowserTestWithPluginPowerSaver() override {} | |
| 1362 | |
| 1363 void SetUpInProcessBrowserTestFixture() override { | |
| 1364 PrerenderBrowserTest::SetUpInProcessBrowserTestFixture(); | |
| 1365 feature_list.InitAndDisableFeature(features::kPreferHtmlOverPlugins); | |
| 1366 } | |
| 1367 | |
| 1368 private: | |
| 1369 base::test::ScopedFeatureList feature_list; | |
| 1370 }; | |
| 1371 | |
| 1372 // For Plugin Power Saver, checks that plugins are not loaded while | 1362 // For Plugin Power Saver, checks that plugins are not loaded while |
| 1373 // a page is being preloaded, but are loaded when the page is displayed. | 1363 // a page is being preloaded, but are loaded when the page is displayed. |
| 1374 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTestWithPluginPowerSaver, | 1364 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPluginPowerSaver) { |
| 1375 PrerenderPluginPowerSaver) { | |
| 1376 HostContentSettingsMap* content_settings_map = | 1365 HostContentSettingsMap* content_settings_map = |
| 1377 HostContentSettingsMapFactory::GetForProfile( | 1366 HostContentSettingsMapFactory::GetForProfile( |
| 1378 current_browser()->profile()); | 1367 current_browser()->profile()); |
| 1379 content_settings_map->SetDefaultContentSetting( | 1368 content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
| 1380 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); | 1369 CONTENT_SETTING_ALLOW); |
|
Reid Kleckner
2016/10/05 17:32:47
This change broke this test on all the Clang ToT W
| |
| 1381 | 1370 |
| 1382 PrerenderTestURL("/prerender/prerender_plugin_power_saver.html", | 1371 PrerenderTestURL("/prerender/prerender_plugin_power_saver.html", |
| 1383 FINAL_STATUS_USED, 1); | 1372 FINAL_STATUS_USED, 1); |
| 1384 | 1373 |
| 1385 DisableJavascriptCalls(); | 1374 DisableJavascriptCalls(); |
| 1386 NavigateToDestURL(); | 1375 NavigateToDestURL(); |
| 1387 bool second_placeholder_present = false; | 1376 bool second_placeholder_present = false; |
| 1388 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 1377 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 1389 GetActiveWebContents(), "AwaitPluginPrerollAndPlaceholder();", | 1378 GetActiveWebContents(), "AwaitPluginPrerollAndPlaceholder();", |
| 1390 &second_placeholder_present)); | 1379 &second_placeholder_present)); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1433 DISABLED_PrerenderIframeDelayLoadPlugin | 1422 DISABLED_PrerenderIframeDelayLoadPlugin |
| 1434 #elif defined(OS_WIN) && defined(ARCH_CPU_X86_64) | 1423 #elif defined(OS_WIN) && defined(ARCH_CPU_X86_64) |
| 1435 // TODO(jschuh): Failing plugin tests. crbug.com/244653 | 1424 // TODO(jschuh): Failing plugin tests. crbug.com/244653 |
| 1436 #define MAYBE_PrerenderIframeDelayLoadPlugin \ | 1425 #define MAYBE_PrerenderIframeDelayLoadPlugin \ |
| 1437 DISABLED_PrerenderIframeDelayLoadPlugin | 1426 DISABLED_PrerenderIframeDelayLoadPlugin |
| 1438 #else | 1427 #else |
| 1439 #define MAYBE_PrerenderIframeDelayLoadPlugin PrerenderIframeDelayLoadPlugin | 1428 #define MAYBE_PrerenderIframeDelayLoadPlugin PrerenderIframeDelayLoadPlugin |
| 1440 #endif | 1429 #endif |
| 1441 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1430 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
| 1442 MAYBE_PrerenderIframeDelayLoadPlugin) { | 1431 MAYBE_PrerenderIframeDelayLoadPlugin) { |
| 1432 HostContentSettingsMap* content_settings_map = | |
| 1433 HostContentSettingsMapFactory::GetForProfile( | |
| 1434 current_browser()->profile()); | |
| 1435 content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | |
| 1436 CONTENT_SETTING_ALLOW); | |
| 1437 | |
| 1443 PrerenderTestURL("/prerender/prerender_iframe_plugin_delay_load.html", | 1438 PrerenderTestURL("/prerender/prerender_iframe_plugin_delay_load.html", |
| 1444 FINAL_STATUS_USED, 1); | 1439 FINAL_STATUS_USED, 1); |
| 1445 NavigateToDestURL(); | 1440 NavigateToDestURL(); |
| 1446 } | 1441 } |
| 1447 | 1442 |
| 1448 // Renders a page that contains a prerender link to a page that contains an | 1443 // Renders a page that contains a prerender link to a page that contains an |
| 1449 // iframe with a source that requires http authentication. This should not | 1444 // iframe with a source that requires http authentication. This should not |
| 1450 // prerender successfully. | 1445 // prerender successfully. |
| 1451 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttpAuthentication) { | 1446 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttpAuthentication) { |
| 1452 PrerenderTestURL("/prerender/prerender_http_auth_container.html", | 1447 PrerenderTestURL("/prerender/prerender_http_auth_container.html", |
| (...skipping 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3381 browser()->tab_strip_model()->GetActiveWebContents(); | 3376 browser()->tab_strip_model()->GetActiveWebContents(); |
| 3382 bool display_test_result = false; | 3377 bool display_test_result = false; |
| 3383 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, | 3378 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, |
| 3384 "DidDisplayReallyPass()", | 3379 "DidDisplayReallyPass()", |
| 3385 &display_test_result)); | 3380 &display_test_result)); |
| 3386 ASSERT_TRUE(display_test_result); | 3381 ASSERT_TRUE(display_test_result); |
| 3387 } | 3382 } |
| 3388 #endif // !defined(DISABLE_NACL) | 3383 #endif // !defined(DISABLE_NACL) |
| 3389 | 3384 |
| 3390 } // namespace prerender | 3385 } // namespace prerender |
| OLD | NEW |