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

Side by Side Diff: third_party/WebKit/Source/platform/loader/testing/MockFetchContext.h

Issue 2790693002: Split CSP into pre- and post-upgrade checks (Closed)
Patch Set: revert accidental AbstractWorker change Created 3 years, 8 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
OLDNEW
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 #ifndef MockFetchContext_h 5 #ifndef MockFetchContext_h
6 #define MockFetchContext_h 6 #define MockFetchContext_h
7 7
8 #include "platform/loader/fetch/FetchContext.h" 8 #include "platform/loader/fetch/FetchContext.h"
9 #include "platform/loader/fetch/FetchParameters.h" 9 #include "platform/loader/fetch/FetchParameters.h"
10 #include "platform/loader/fetch/ResourceTimingInfo.h" 10 #include "platform/loader/fetch/ResourceTimingInfo.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 ResourceRequestBlockedReason CanRequest( 48 ResourceRequestBlockedReason CanRequest(
49 Resource::Type, 49 Resource::Type,
50 const ResourceRequest&, 50 const ResourceRequest&,
51 const KURL&, 51 const KURL&,
52 const ResourceLoaderOptions&, 52 const ResourceLoaderOptions&,
53 SecurityViolationReportingPolicy, 53 SecurityViolationReportingPolicy,
54 FetchParameters::OriginRestriction) const override { 54 FetchParameters::OriginRestriction) const override {
55 return ResourceRequestBlockedReason::kNone; 55 return ResourceRequestBlockedReason::kNone;
56 } 56 }
57 ResourceRequestBlockedReason CanFollowRedirect(
58 Resource::Type type,
59 const ResourceRequest& request,
60 const KURL& url,
61 const ResourceLoaderOptions& options,
62 SecurityViolationReportingPolicy reporting_policy,
63 FetchParameters::OriginRestriction origin_restriction) const override {
64 return CanRequest(type, request, url, options, reporting_policy,
65 origin_restriction);
66 }
57 bool ShouldLoadNewResource(Resource::Type) const override { 67 bool ShouldLoadNewResource(Resource::Type) const override {
58 return load_policy_ == kShouldLoadNewResource; 68 return load_policy_ == kShouldLoadNewResource;
59 } 69 }
60 RefPtr<WebTaskRunner> LoadingTaskRunner() const override { return runner_; } 70 RefPtr<WebTaskRunner> LoadingTaskRunner() const override { return runner_; }
61 bool IsLoadComplete() const override { return complete_; } 71 bool IsLoadComplete() const override { return complete_; }
62 void AddResourceTiming( 72 void AddResourceTiming(
63 const ResourceTimingInfo& resource_timing_info) override { 73 const ResourceTimingInfo& resource_timing_info) override {
64 transfer_size_ = resource_timing_info.TransferSize(); 74 transfer_size_ = resource_timing_info.TransferSize();
65 } 75 }
66 76
67 private: 77 private:
68 MockFetchContext(LoadPolicy load_policy, RefPtr<WebTaskRunner> task_runner) 78 MockFetchContext(LoadPolicy load_policy, RefPtr<WebTaskRunner> task_runner)
69 : load_policy_(load_policy), 79 : load_policy_(load_policy),
70 runner_(task_runner ? std::move(task_runner) 80 runner_(task_runner ? std::move(task_runner)
71 : AdoptRef(new scheduler::FakeWebTaskRunner)), 81 : AdoptRef(new scheduler::FakeWebTaskRunner)),
72 complete_(false), 82 complete_(false),
73 transfer_size_(-1) {} 83 transfer_size_(-1) {}
74 84
75 enum LoadPolicy load_policy_; 85 enum LoadPolicy load_policy_;
76 RefPtr<WebTaskRunner> runner_; 86 RefPtr<WebTaskRunner> runner_;
77 bool complete_; 87 bool complete_;
78 long long transfer_size_; 88 long long transfer_size_;
79 }; 89 };
80 90
81 } // namespace blink 91 } // namespace blink
82 92
83 #endif 93 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698