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

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

Issue 1444413002: Revert of Simplify starting a navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 int marginWidth() const override { return -1; } 89 int marginWidth() const override { return -1; }
90 int marginHeight() const override { return -1; } 90 int marginHeight() const override { return -1; }
91 }; 91 };
92 92
93 class FrameFetchContextTest : public ::testing::Test { 93 class FrameFetchContextTest : public ::testing::Test {
94 protected: 94 protected:
95 void SetUp() override 95 void SetUp() override
96 { 96 {
97 dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); 97 dummyPageHolder = DummyPageHolder::create(IntSize(500, 500));
98 dummyPageHolder->page().setDeviceScaleFactor(1.0); 98 dummyPageHolder->page().setDeviceScaleFactor(1.0);
99 documentLoader = DocumentLoader::create(&dummyPageHolder->frame(), Resou rceRequest("http://www.example.com"), SubstituteData());
99 document = toHTMLDocument(&dummyPageHolder->document()); 100 document = toHTMLDocument(&dummyPageHolder->document());
100 documentLoader = document->loader();
101 fetchContext = static_cast<FrameFetchContext*>(&documentLoader->fetcher( )->context()); 101 fetchContext = static_cast<FrameFetchContext*>(&documentLoader->fetcher( )->context());
102 owner = StubFrameOwner::create(); 102 owner = StubFrameOwner::create();
103 FrameFetchContext::provideDocumentToContext(*fetchContext, document.get( )); 103 FrameFetchContext::provideDocumentToContext(*fetchContext, document.get( ));
104 } 104 }
105 105
106 void TearDown() override 106 void TearDown() override
107 { 107 {
108 documentLoader->detachFromFrame();
108 documentLoader.clear(); 109 documentLoader.clear();
109 110
110 if (childFrame) { 111 if (childFrame) {
112 childDocumentLoader->detachFromFrame();
111 childDocumentLoader.clear(); 113 childDocumentLoader.clear();
112 childFrame->detach(FrameDetachType::Remove); 114 childFrame->detach(FrameDetachType::Remove);
113 } 115 }
114 } 116 }
115 117
116 FrameFetchContext* createChildFrame() 118 FrameFetchContext* createChildFrame()
117 { 119 {
118 childClient = StubFrameLoaderClientWithParent::create(document->frame()) ; 120 childClient = StubFrameLoaderClientWithParent::create(document->frame()) ;
119 childFrame = LocalFrame::create(childClient.get(), document->frame()->ho st(), owner.get()); 121 childFrame = LocalFrame::create(childClient.get(), document->frame()->ho st(), owner.get());
120 childFrame->setView(FrameView::create(childFrame.get(), IntSize(500, 500 ))); 122 childFrame->setView(FrameView::create(childFrame.get(), IntSize(500, 500 )));
121 childFrame->init(); 123 childFrame->init();
124 childDocumentLoader = DocumentLoader::create(childFrame.get(), ResourceR equest("http://www.example.com"), SubstituteData());
122 childDocument = childFrame->document(); 125 childDocument = childFrame->document();
123 childDocumentLoader = childDocument->loader();
124 FrameFetchContext* childFetchContext = static_cast<FrameFetchContext*>(& childDocumentLoader->fetcher()->context()); 126 FrameFetchContext* childFetchContext = static_cast<FrameFetchContext*>(& childDocumentLoader->fetcher()->context());
125 FrameFetchContext::provideDocumentToContext(*childFetchContext, childDoc ument.get()); 127 FrameFetchContext::provideDocumentToContext(*childFetchContext, childDoc ument.get());
126 return childFetchContext; 128 return childFetchContext;
127 } 129 }
128 130
129 OwnPtr<DummyPageHolder> dummyPageHolder; 131 OwnPtr<DummyPageHolder> dummyPageHolder;
130 // We don't use the DocumentLoader directly in any tests, but need to keep i t around as long 132 // We don't use the DocumentLoader directly in any tests, but need to keep i t around as long
131 // as the ResourceFetcher and Document live due to indirect usage. 133 // as the ResourceFetcher and Document live due to indirect usage.
132 RefPtrWillBePersistent<DocumentLoader> documentLoader; 134 RefPtrWillBePersistent<DocumentLoader> documentLoader;
133 RefPtrWillBePersistent<Document> document; 135 RefPtrWillBePersistent<Document> document;
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 EXPECT_EQ(ResourceLoadPriorityVeryHigh, childFetchContext->modifyPriorityFor Experiments(ResourceLoadPriorityVeryHigh, Resource::MainResource, request, Resou rcePriority::NotVisible)); 509 EXPECT_EQ(ResourceLoadPriorityVeryHigh, childFetchContext->modifyPriorityFor Experiments(ResourceLoadPriorityVeryHigh, Resource::MainResource, request, Resou rcePriority::NotVisible));
508 EXPECT_EQ(ResourceLoadPriorityMedium, childFetchContext->modifyPriorityForEx periments(ResourceLoadPriorityMedium, Resource::Script, request, ResourcePriorit y::NotVisible)); 510 EXPECT_EQ(ResourceLoadPriorityMedium, childFetchContext->modifyPriorityForEx periments(ResourceLoadPriorityMedium, Resource::Script, request, ResourcePriorit y::NotVisible));
509 511
510 // Low priority iframes enabled, everything should be low priority 512 // Low priority iframes enabled, everything should be low priority
511 settings->setLowPriorityIframes(true); 513 settings->setLowPriorityIframes(true);
512 EXPECT_EQ(ResourceLoadPriorityVeryLow, childFetchContext->modifyPriorityForE xperiments(ResourceLoadPriorityVeryHigh, Resource::MainResource, request, Resour cePriority::NotVisible)); 514 EXPECT_EQ(ResourceLoadPriorityVeryLow, childFetchContext->modifyPriorityForE xperiments(ResourceLoadPriorityVeryHigh, Resource::MainResource, request, Resour cePriority::NotVisible));
513 EXPECT_EQ(ResourceLoadPriorityVeryLow, childFetchContext->modifyPriorityForE xperiments(ResourceLoadPriorityMedium, Resource::Script, request, ResourcePriori ty::NotVisible)); 515 EXPECT_EQ(ResourceLoadPriorityVeryLow, childFetchContext->modifyPriorityForE xperiments(ResourceLoadPriorityMedium, Resource::Script, request, ResourcePriori ty::NotVisible));
514 } 516 }
515 517
516 } // namespace 518 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.cpp ('k') | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698