| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | 6 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
| 7 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" | 7 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" |
| 8 #include "chrome/browser/predictors/resource_prefetch_predictor_test_util.h" | 8 #include "chrome/browser/predictors/resource_prefetch_predictor_test_util.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 AddExternalResource(GetURL(kScriptDocumentWritePath), | 449 AddExternalResource(GetURL(kScriptDocumentWritePath), |
| 450 content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); | 450 content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| 451 externalScript->request.mime_type = kJavascriptMime; | 451 externalScript->request.mime_type = kJavascriptMime; |
| 452 AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, net::LOWEST); | 452 AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, net::LOWEST); |
| 453 AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, | 453 AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, |
| 454 net::HIGHEST); | 454 net::HIGHEST); |
| 455 AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); | 455 AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| 456 NavigateToURLAndCheckSubresources(GetURL(kHtmlDocumentWritePath)); | 456 NavigateToURLAndCheckSubresources(GetURL(kHtmlDocumentWritePath)); |
| 457 } | 457 } |
| 458 | 458 |
| 459 // Disabled due to flakiness (crbug.com/673028). | |
| 460 IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, | 459 IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, |
| 461 DISABLED_LearningJavascriptAppendChild) { | 460 LearningJavascriptAppendChild) { |
| 462 auto externalScript = | 461 auto externalScript = |
| 463 AddExternalResource(GetURL(kScriptAppendChildPath), | 462 AddExternalResource(GetURL(kScriptAppendChildPath), |
| 464 content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); | 463 content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| 465 externalScript->request.mime_type = kJavascriptMime; | 464 externalScript->request.mime_type = kJavascriptMime; |
| 466 AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, net::LOWEST); | 465 AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, net::LOWEST); |
| 467 AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, | 466 AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, |
| 468 net::HIGHEST); | 467 net::HIGHEST); |
| 469 // This script has net::LOWEST priority because it's executed asynchronously. | 468 // This script has net::LOWEST priority because it's executed asynchronously. |
| 470 AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, net::LOWEST); | 469 AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, net::LOWEST); |
| 471 NavigateToURLAndCheckSubresources(GetURL(kHtmlAppendChildPath)); | 470 NavigateToURLAndCheckSubresources(GetURL(kHtmlAppendChildPath)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 AddResource(GetURL(kStylePath2), content::RESOURCE_TYPE_STYLESHEET, | 511 AddResource(GetURL(kStylePath2), content::RESOURCE_TYPE_STYLESHEET, |
| 513 net::HIGHEST); | 512 net::HIGHEST); |
| 514 AddResource(GetURL(kScriptPath2), content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); | 513 AddResource(GetURL(kScriptPath2), content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| 515 // Included from <iframe src="html_subresources.html"> and not recored. | 514 // Included from <iframe src="html_subresources.html"> and not recored. |
| 516 AddUnrecordedResources({GetURL(kImagePath), GetURL(kStylePath), | 515 AddUnrecordedResources({GetURL(kImagePath), GetURL(kStylePath), |
| 517 GetURL(kScriptPath), GetURL(kFontPath)}); | 516 GetURL(kScriptPath), GetURL(kFontPath)}); |
| 518 NavigateToURLAndCheckSubresources(GetURL(kHtmlIframePath)); | 517 NavigateToURLAndCheckSubresources(GetURL(kHtmlIframePath)); |
| 519 } | 518 } |
| 520 | 519 |
| 521 } // namespace predictors | 520 } // namespace predictors |
| OLD | NEW |