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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 1667843003: Make Resource RefCountedWillBeGarbageCollectedFinalized, attempt #2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + address review comments Created 4 years, 10 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 | « third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp ('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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 6704 matching lines...) Expand 10 before | Expand all | Expand 10 after
6715 { 6715 {
6716 registerMockedHttpURLLoad("link-manifest-change.html"); 6716 registerMockedHttpURLLoad("link-manifest-change.html");
6717 6717
6718 ManifestChangeWebFrameClient webFrameClient; 6718 ManifestChangeWebFrameClient webFrameClient;
6719 FrameTestHelpers::WebViewHelper webViewHelper(this); 6719 FrameTestHelpers::WebViewHelper webViewHelper(this);
6720 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient); 6720 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient);
6721 6721
6722 EXPECT_EQ(14, webFrameClient.manifestChangeCount()); 6722 EXPECT_EQ(14, webFrameClient.manifestChangeCount());
6723 } 6723 }
6724 6724
6725 static ResourcePtr<Resource> fetchManifest(Document* document, const KURL& url) 6725 static PassRefPtrWillBeRawPtr<Resource> fetchManifest(Document* document, const KURL& url)
6726 { 6726 {
6727 FetchRequest fetchRequest = FetchRequest(ResourceRequest(url), FetchInitiato rInfo()); 6727 FetchRequest fetchRequest = FetchRequest(ResourceRequest(url), FetchInitiato rInfo());
6728 fetchRequest.mutableResourceRequest().setRequestContext(WebURLRequest::Reque stContextManifest); 6728 fetchRequest.mutableResourceRequest().setRequestContext(WebURLRequest::Reque stContextManifest);
6729 6729
6730 return RawResource::fetchSynchronously(fetchRequest, document->fetcher()); 6730 return RawResource::fetchSynchronously(fetchRequest, document->fetcher());
6731 } 6731 }
6732 6732
6733 TEST_P(ParameterizedWebFrameTest, ManifestFetch) 6733 TEST_P(ParameterizedWebFrameTest, ManifestFetch)
6734 { 6734 {
6735 registerMockedHttpURLLoad("foo.html"); 6735 registerMockedHttpURLLoad("foo.html");
6736 registerMockedHttpURLLoad("link-manifest-fetch.json"); 6736 registerMockedHttpURLLoad("link-manifest-fetch.json");
6737 6737
6738 FrameTestHelpers::WebViewHelper webViewHelper(this); 6738 FrameTestHelpers::WebViewHelper webViewHelper(this);
6739 webViewHelper.initializeAndLoad(m_baseURL + "foo.html"); 6739 webViewHelper.initializeAndLoad(m_baseURL + "foo.html");
6740 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr ame())->frame()->document(); 6740 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr ame())->frame()->document();
6741 6741
6742 ResourcePtr<Resource> resource = fetchManifest(document, toKURL(m_baseURL + "link-manifest-fetch.json")); 6742 RefPtrWillBeRawPtr<Resource> resource = fetchManifest(document, toKURL(m_bas eURL + "link-manifest-fetch.json"));
6743 6743
6744 EXPECT_TRUE(resource->isLoaded()); 6744 EXPECT_TRUE(resource->isLoaded());
6745 } 6745 }
6746 6746
6747 TEST_P(ParameterizedWebFrameTest, ManifestCSPFetchAllow) 6747 TEST_P(ParameterizedWebFrameTest, ManifestCSPFetchAllow)
6748 { 6748 {
6749 URLTestHelpers::registerMockedURLLoad(toKURL(m_notBaseURL + "link-manifest-f etch.json"), "link-manifest-fetch.json"); 6749 URLTestHelpers::registerMockedURLLoad(toKURL(m_notBaseURL + "link-manifest-f etch.json"), "link-manifest-fetch.json");
6750 registerMockedHttpURLLoadWithCSP("foo.html", "manifest-src *"); 6750 registerMockedHttpURLLoadWithCSP("foo.html", "manifest-src *");
6751 6751
6752 FrameTestHelpers::WebViewHelper webViewHelper(this); 6752 FrameTestHelpers::WebViewHelper webViewHelper(this);
6753 webViewHelper.initializeAndLoad(m_baseURL + "foo.html"); 6753 webViewHelper.initializeAndLoad(m_baseURL + "foo.html");
6754 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr ame())->frame()->document(); 6754 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr ame())->frame()->document();
6755 6755
6756 ResourcePtr<Resource> resource = fetchManifest(document, toKURL(m_notBaseURL + "link-manifest-fetch.json")); 6756 RefPtrWillBeRawPtr<Resource> resource = fetchManifest(document, toKURL(m_not BaseURL + "link-manifest-fetch.json"));
6757 6757
6758 EXPECT_TRUE(resource->isLoaded()); 6758 EXPECT_TRUE(resource->isLoaded());
6759 } 6759 }
6760 6760
6761 TEST_P(ParameterizedWebFrameTest, ManifestCSPFetchSelf) 6761 TEST_P(ParameterizedWebFrameTest, ManifestCSPFetchSelf)
6762 { 6762 {
6763 URLTestHelpers::registerMockedURLLoad(toKURL(m_notBaseURL + "link-manifest-f etch.json"), "link-manifest-fetch.json"); 6763 URLTestHelpers::registerMockedURLLoad(toKURL(m_notBaseURL + "link-manifest-f etch.json"), "link-manifest-fetch.json");
6764 registerMockedHttpURLLoadWithCSP("foo.html", "manifest-src 'self'"); 6764 registerMockedHttpURLLoadWithCSP("foo.html", "manifest-src 'self'");
6765 6765
6766 FrameTestHelpers::WebViewHelper webViewHelper(this); 6766 FrameTestHelpers::WebViewHelper webViewHelper(this);
6767 webViewHelper.initializeAndLoad(m_baseURL + "foo.html"); 6767 webViewHelper.initializeAndLoad(m_baseURL + "foo.html");
6768 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr ame())->frame()->document(); 6768 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr ame())->frame()->document();
6769 6769
6770 ResourcePtr<Resource> resource = fetchManifest(document, toKURL(m_notBaseURL + "link-manifest-fetch.json")); 6770 RefPtrWillBeRawPtr<Resource> resource = fetchManifest(document, toKURL(m_not BaseURL + "link-manifest-fetch.json"));
6771 6771
6772 EXPECT_EQ(0, resource.get()); // Fetching resource wasn't allowed. 6772 EXPECT_EQ(0, resource.get()); // Fetching resource wasn't allowed.
6773 } 6773 }
6774 6774
6775 TEST_P(ParameterizedWebFrameTest, ManifestCSPFetchSelfReportOnly) 6775 TEST_P(ParameterizedWebFrameTest, ManifestCSPFetchSelfReportOnly)
6776 { 6776 {
6777 URLTestHelpers::registerMockedURLLoad(toKURL(m_notBaseURL + "link-manifest-f etch.json"), "link-manifest-fetch.json"); 6777 URLTestHelpers::registerMockedURLLoad(toKURL(m_notBaseURL + "link-manifest-f etch.json"), "link-manifest-fetch.json");
6778 registerMockedHttpURLLoadWithCSP("foo.html", "manifest-src 'self'", /* repor t only */ true); 6778 registerMockedHttpURLLoadWithCSP("foo.html", "manifest-src 'self'", /* repor t only */ true);
6779 6779
6780 FrameTestHelpers::WebViewHelper webViewHelper(this); 6780 FrameTestHelpers::WebViewHelper webViewHelper(this);
6781 webViewHelper.initializeAndLoad(m_baseURL + "foo.html"); 6781 webViewHelper.initializeAndLoad(m_baseURL + "foo.html");
6782 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr ame())->frame()->document(); 6782 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr ame())->frame()->document();
6783 6783
6784 ResourcePtr<Resource> resource = fetchManifest(document, toKURL(m_notBaseURL + "link-manifest-fetch.json")); 6784 RefPtrWillBeRawPtr<Resource> resource = fetchManifest(document, toKURL(m_not BaseURL + "link-manifest-fetch.json"));
6785 6785
6786 EXPECT_TRUE(resource->isLoaded()); 6786 EXPECT_TRUE(resource->isLoaded());
6787 } 6787 }
6788 6788
6789 TEST_P(ParameterizedWebFrameTest, ReloadBypassingCache) 6789 TEST_P(ParameterizedWebFrameTest, ReloadBypassingCache)
6790 { 6790 {
6791 // Check that a reload ignoring cache on a frame will result in the cache 6791 // Check that a reload ignoring cache on a frame will result in the cache
6792 // policy of the request being set to ReloadBypassingCache. 6792 // policy of the request being set to ReloadBypassingCache.
6793 registerMockedHttpURLLoad("foo.html"); 6793 registerMockedHttpURLLoad("foo.html");
6794 FrameTestHelpers::WebViewHelper webViewHelper(this); 6794 FrameTestHelpers::WebViewHelper webViewHelper(this);
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
8406 } 8406 }
8407 8407
8408 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) 8408 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange)
8409 { 8409 {
8410 swapLocalFrameToRemoteFrame(); 8410 swapLocalFrameToRemoteFrame();
8411 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p arentElement.style.display = 'none';")); 8411 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p arentElement.style.display = 'none';"));
8412 EXPECT_FALSE(remoteFrameClient()->isVisible()); 8412 EXPECT_FALSE(remoteFrameClient()->isVisible());
8413 } 8413 }
8414 8414
8415 } // namespace blink 8415 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698