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

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

Issue 2724903004: Add ELEMENT_TYPE_WEBSOCKET to subresource filter (Closed)
Patch Set: rebase Created 3 years, 9 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 /* 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 class FixedPolicySubresourceFilter : public WebDocumentSubresourceFilter { 88 class FixedPolicySubresourceFilter : public WebDocumentSubresourceFilter {
89 public: 89 public:
90 FixedPolicySubresourceFilter(LoadPolicy policy, int* filteredLoadCounter) 90 FixedPolicySubresourceFilter(LoadPolicy policy, int* filteredLoadCounter)
91 : m_policy(policy), m_filteredLoadCounter(filteredLoadCounter) {} 91 : m_policy(policy), m_filteredLoadCounter(filteredLoadCounter) {}
92 92
93 LoadPolicy getLoadPolicy(const WebURL& resourceUrl, 93 LoadPolicy getLoadPolicy(const WebURL& resourceUrl,
94 WebURLRequest::RequestContext) override { 94 WebURLRequest::RequestContext) override {
95 return m_policy; 95 return m_policy;
96 } 96 }
97 97
98 LoadPolicy getLoadPolicyForWebSocketConnect(const WebURL& url) override {
99 return m_policy;
100 }
101
98 void reportDisallowedLoad() override { ++*m_filteredLoadCounter; } 102 void reportDisallowedLoad() override { ++*m_filteredLoadCounter; }
99 103
100 private: 104 private:
101 const LoadPolicy m_policy; 105 const LoadPolicy m_policy;
102 int* m_filteredLoadCounter; 106 int* m_filteredLoadCounter;
103 }; 107 };
104 108
105 class FrameFetchContextTest : public ::testing::Test { 109 class FrameFetchContextTest : public ::testing::Test {
106 protected: 110 protected:
107 void SetUp() override { 111 void SetUp() override {
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 setFilterPolicy(WebDocumentSubresourceFilter::WouldDisallow); 906 setFilterPolicy(WebDocumentSubresourceFilter::WouldDisallow);
903 907
904 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequest()); 908 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequest());
905 EXPECT_EQ(0, getFilteredLoadCallCount()); 909 EXPECT_EQ(0, getFilteredLoadCallCount());
906 910
907 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequestPreload()); 911 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequestPreload());
908 EXPECT_EQ(0, getFilteredLoadCallCount()); 912 EXPECT_EQ(0, getFilteredLoadCallCount());
909 } 913 }
910 914
911 } // namespace blink 915 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698