Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/WebRequest.cpp

Issue 29382567: No issue - change initialiser calls (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Created March 13, 2017, 2:11 p.m.
Right Patch Set: Updated commit message. Created March 16, 2017, 4:14 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 lastLogLevel = AdblockPlus::LogSystem::LOG_LEVEL_TRACE; 200 lastLogLevel = AdblockPlus::LogSystem::LOG_LEVEL_TRACE;
201 lastMessage.clear(); 201 lastMessage.clear();
202 } 202 }
203 }; 203 };
204 204
205 typedef std::shared_ptr<CatchLogSystem> CatchLogSystemPtr; 205 typedef std::shared_ptr<CatchLogSystem> CatchLogSystemPtr;
206 } 206 }
207 207
208 TEST_F(XMLHttpRequestTest, RequestHeaderValidation) 208 TEST_F(XMLHttpRequestTest, RequestHeaderValidation)
209 { 209 {
210 CatchLogSystemPtr catchLogSystem = std::make_shared<CatchLogSystem>(); 210 auto catchLogSystem = CatchLogSystemPtr(new CatchLogSystem());
sergei 2017/03/13 14:33:45 with std::make_shared `auto` is preferred :)
211 jsEngine->SetLogSystem(catchLogSystem); 211 jsEngine->SetLogSystem(catchLogSystem);
212 212
213 AdblockPlus::FilterEngine filterEngine(jsEngine); 213 AdblockPlus::FilterEngine filterEngine(jsEngine);
214 auto webRequest = 214 auto webRequest =
215 std::static_pointer_cast<MockWebRequest>(jsEngine->GetWebRequest()); 215 std::static_pointer_cast<MockWebRequest>(jsEngine->GetWebRequest());
216 216
217 ASSERT_TRUE(webRequest); 217 ASSERT_TRUE(webRequest);
218 218
219 const std::string msg = "Attempt to set a forbidden header was denied: "; 219 const std::string msg = "Attempt to set a forbidden header was denied: ";
220 220
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 catchLogSystem->clear(); 281 catchLogSystem->clear();
282 ResetTestXHR(jsEngine); 282 ResetTestXHR(jsEngine);
283 jsEngine->Evaluate("\ 283 jsEngine->Evaluate("\
284 request.setRequestHeader('Security', 'theater');\nrequest.send();"); 284 request.setRequestHeader('Security', 'theater');\nrequest.send();");
285 EXPECT_EQ(AdblockPlus::LogSystem::LOG_LEVEL_TRACE, catchLogSystem->lastLogLeve l); 285 EXPECT_EQ(AdblockPlus::LogSystem::LOG_LEVEL_TRACE, catchLogSystem->lastLogLeve l);
286 EXPECT_EQ("", catchLogSystem->lastMessage); 286 EXPECT_EQ("", catchLogSystem->lastMessage);
287 WaitForVariable("result", jsEngine); 287 WaitForVariable("result", jsEngine);
288 EXPECT_FALSE(webRequest->lastRequestHeaders.cend() == 288 EXPECT_FALSE(webRequest->lastRequestHeaders.cend() ==
289 webRequest->lastRequestHeaders.find("Security")); 289 webRequest->lastRequestHeaders.find("Security"));
290 } 290 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld