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

Side by Side Diff: Source/core/loader/FrameFetchContextTest.cpp

Issue 1314773009: Oilpan: fix build after r201667. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: more transition type fixes Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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) 2015, Google Inc. All rights reserved. 2 * Copyright (c) 2015, 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 : m_parent(parent) 67 : m_parent(parent)
68 { 68 {
69 } 69 }
70 70
71 RawPtrWillBeMember<Frame> m_parent; 71 RawPtrWillBeMember<Frame> m_parent;
72 }; 72 };
73 73
74 class StubFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<StubFrameOwn er>, public FrameOwner { 74 class StubFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<StubFrameOwn er>, public FrameOwner {
75 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(StubFrameOwner); 75 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(StubFrameOwner);
76 public: 76 public:
77 static PassOwnPtrWillBeRawPtr<StubFrameOwner> create()
78 {
79 return adoptPtrWillBeNoop(new StubFrameOwner);
80 }
81
77 DEFINE_INLINE_VIRTUAL_TRACE() { FrameOwner::trace(visitor); } 82 DEFINE_INLINE_VIRTUAL_TRACE() { FrameOwner::trace(visitor); }
78 83
79 bool isLocal() const override { return false; } 84 bool isLocal() const override { return false; }
80 SandboxFlags sandboxFlags() const override { return SandboxNone; } 85 SandboxFlags sandboxFlags() const override { return SandboxNone; }
81 void dispatchLoad() override { } 86 void dispatchLoad() override { }
82 void renderFallbackContent() override { } 87 void renderFallbackContent() override { }
83 }; 88 };
84 89
85 class FrameFetchContextTest : public ::testing::Test { 90 class FrameFetchContextTest : public ::testing::Test {
86 protected: 91 protected:
87 void SetUp() override 92 void SetUp() override
88 { 93 {
89 dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); 94 dummyPageHolder = DummyPageHolder::create(IntSize(500, 500));
90 dummyPageHolder->page().setDeviceScaleFactor(1.0); 95 dummyPageHolder->page().setDeviceScaleFactor(1.0);
91 documentLoader = DocumentLoader::create(&dummyPageHolder->frame(), Resou rceRequest("http://www.example.com"), SubstituteData()); 96 documentLoader = DocumentLoader::create(&dummyPageHolder->frame(), Resou rceRequest("http://www.example.com"), SubstituteData());
92 document = toHTMLDocument(&dummyPageHolder->document()); 97 document = toHTMLDocument(&dummyPageHolder->document());
93 fetchContext = static_cast<FrameFetchContext*>(&documentLoader->fetcher( )->context()); 98 fetchContext = static_cast<FrameFetchContext*>(&documentLoader->fetcher( )->context());
99 owner = StubFrameOwner::create();
94 FrameFetchContext::provideDocumentToContext(*fetchContext, document.get( )); 100 FrameFetchContext::provideDocumentToContext(*fetchContext, document.get( ));
95 } 101 }
96 102
97 void TearDown() override 103 void TearDown() override
98 { 104 {
99 documentLoader->detachFromFrame(); 105 documentLoader->detachFromFrame();
100 documentLoader.clear(); 106 documentLoader.clear();
101 107
102 if (childFrame) { 108 if (childFrame) {
103 childDocumentLoader->detachFromFrame(); 109 childDocumentLoader->detachFromFrame();
104 childDocumentLoader.clear(); 110 childDocumentLoader.clear();
105 childFrame->detach(FrameDetachType::Remove); 111 childFrame->detach(FrameDetachType::Remove);
106 } 112 }
107 } 113 }
108 114
109 FrameFetchContext* createChildFrame() 115 FrameFetchContext* createChildFrame()
110 { 116 {
111 childClient = StubFrameLoaderClientWithParent::create(document->frame()) ; 117 childClient = StubFrameLoaderClientWithParent::create(document->frame()) ;
112 childFrame = LocalFrame::create(childClient.get(), document->frame()->ho st(), &owner); 118 childFrame = LocalFrame::create(childClient.get(), document->frame()->ho st(), owner.get());
113 childFrame->setView(FrameView::create(childFrame.get(), IntSize(500, 500 ))); 119 childFrame->setView(FrameView::create(childFrame.get(), IntSize(500, 500 )));
114 childFrame->init(); 120 childFrame->init();
115 childDocumentLoader = DocumentLoader::create(childFrame.get(), ResourceR equest("http://www.example.com"), SubstituteData()); 121 childDocumentLoader = DocumentLoader::create(childFrame.get(), ResourceR equest("http://www.example.com"), SubstituteData());
116 childDocument = childFrame->document(); 122 childDocument = childFrame->document();
117 FrameFetchContext* childFetchContext = static_cast<FrameFetchContext*>(& childDocumentLoader->fetcher()->context()); 123 FrameFetchContext* childFetchContext = static_cast<FrameFetchContext*>(& childDocumentLoader->fetcher()->context());
118 FrameFetchContext::provideDocumentToContext(*childFetchContext, childDoc ument.get()); 124 FrameFetchContext::provideDocumentToContext(*childFetchContext, childDoc ument.get());
119 return childFetchContext; 125 return childFetchContext;
120 } 126 }
121 127
122 OwnPtr<DummyPageHolder> dummyPageHolder; 128 OwnPtr<DummyPageHolder> dummyPageHolder;
123 // We don't use the DocumentLoader directly in any tests, but need to keep i t around as long 129 // We don't use the DocumentLoader directly in any tests, but need to keep i t around as long
124 // as the ResourceFetcher and Document live due to indirect usage. 130 // as the ResourceFetcher and Document live due to indirect usage.
125 RefPtrWillBePersistent<DocumentLoader> documentLoader; 131 RefPtrWillBePersistent<DocumentLoader> documentLoader;
126 RefPtrWillBePersistent<Document> document; 132 RefPtrWillBePersistent<Document> document;
127 Persistent<FrameFetchContext> fetchContext; 133 Persistent<FrameFetchContext> fetchContext;
128 134
129 OwnPtrWillBeRawPtr<StubFrameLoaderClientWithParent> childClient; 135 OwnPtrWillBePersistent<StubFrameLoaderClientWithParent> childClient;
130 RefPtrWillBeRawPtr<LocalFrame> childFrame; 136 RefPtrWillBePersistent<LocalFrame> childFrame;
131 RefPtrWillBePersistent<DocumentLoader> childDocumentLoader; 137 RefPtrWillBePersistent<DocumentLoader> childDocumentLoader;
132 RefPtrWillBePersistent<Document> childDocument; 138 RefPtrWillBePersistent<Document> childDocument;
133 StubFrameOwner owner; 139 OwnPtrWillBePersistent<StubFrameOwner> owner;
134
135 }; 140 };
136 141
137 class FrameFetchContextUpgradeTest : public FrameFetchContextTest { 142 class FrameFetchContextUpgradeTest : public FrameFetchContextTest {
138 public: 143 public:
139 FrameFetchContextUpgradeTest() 144 FrameFetchContextUpgradeTest()
140 : exampleOrigin(SecurityOrigin::create(KURL(ParsedURLString, "https://ex ample.test/"))) 145 : exampleOrigin(SecurityOrigin::create(KURL(ParsedURLString, "https://ex ample.test/")))
141 , secureOrigin(SecurityOrigin::create(KURL(ParsedURLString, "https://sec ureorigin.test/image.png"))) 146 , secureOrigin(SecurityOrigin::create(KURL(ParsedURLString, "https://sec ureorigin.test/image.png")))
142 { 147 {
143 } 148 }
144 149
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 487
483 // Ensure we don't go out of bounds 488 // Ensure we don't go out of bounds
484 settings->setFEtchIncreasePriorities(true); 489 settings->setFEtchIncreasePriorities(true);
485 EXPECT_EQ(ResourceLoadPriorityVeryHigh, fetchContext->modifyPriorityForExper iments(ResourceLoadPriorityVeryHigh, Resource::Script, request)); 490 EXPECT_EQ(ResourceLoadPriorityVeryHigh, fetchContext->modifyPriorityForExper iments(ResourceLoadPriorityVeryHigh, Resource::Script, request));
486 settings->setFEtchIncreasePriorities(false); 491 settings->setFEtchIncreasePriorities(false);
487 settings->setFEtchDeferLateScripts(true); 492 settings->setFEtchDeferLateScripts(true);
488 EXPECT_EQ(ResourceLoadPriorityVeryLow, fetchContext->modifyPriorityForExperi ments(ResourceLoadPriorityVeryLow, Resource::Script, preloadRequest)); 493 EXPECT_EQ(ResourceLoadPriorityVeryLow, fetchContext->modifyPriorityForExperi ments(ResourceLoadPriorityVeryLow, Resource::Script, preloadRequest));
489 } 494 }
490 495
491 } // namespace 496 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698