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

Unified Diff: test/WebRequest.cpp

Issue 29367003: Issue #4711 - Rewrite legacy thread facilities
Patch Set: Created Dec. 7, 2016, 4:44 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/Thread.h ('K') | « test/UpdateCheck.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/WebRequest.cpp
===================================================================
--- a/test/WebRequest.cpp
+++ b/test/WebRequest.cpp
@@ -17,7 +17,6 @@
#include <sstream>
#include "BaseJsTest.h"
-#include "../src/Thread.h"
namespace
{
@@ -26,7 +25,7 @@
public:
AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::HeaderList& requestHeaders) const
{
- AdblockPlus::Sleep(50);
+ std::this_thread::sleep_for(std::chrono::milliseconds(50));
AdblockPlus::ServerResponse result;
result.status = NS_OK;
@@ -67,7 +66,7 @@
{
jsEngine->Evaluate("_webRequest.GET('http://example.com/', {X: 'Y'}, function(result) {foo = result;} )");
ASSERT_TRUE(jsEngine->Evaluate("this.foo")->IsUndefined());
- AdblockPlus::Sleep(200);
+ std::this_thread::sleep_for(std::chrono::milliseconds(200));
ASSERT_EQ(AdblockPlus::WebRequest::NS_OK, jsEngine->Evaluate("foo.status")->AsInt());
ASSERT_EQ(123, jsEngine->Evaluate("foo.responseStatus")->AsInt());
ASSERT_EQ("http://example.com/\nX\nY", jsEngine->Evaluate("foo.responseText")->AsString());
@@ -82,7 +81,7 @@
jsEngine->Evaluate("_webRequest.GET('https://easylist-downloads.adblockplus.org/easylist.txt', {}, function(result) {foo = result;} )");
do
{
- AdblockPlus::Sleep(200);
+ std::this_thread::sleep_for(std::chrono::milliseconds(200));
} while (jsEngine->Evaluate("this.foo")->IsUndefined());
ASSERT_EQ("text/plain", jsEngine->Evaluate("foo.responseHeaders['content-type'].substr(0, 10)")->AsString());
ASSERT_EQ(AdblockPlus::WebRequest::NS_OK, jsEngine->Evaluate("foo.status")->AsInt());
@@ -108,7 +107,7 @@
request.send(null);");
do
{
- AdblockPlus::Sleep(200);
+ std::this_thread::sleep_for(std::chrono::milliseconds(200));
} while (jsEngine->Evaluate("result")->IsUndefined());
ASSERT_EQ(AdblockPlus::WebRequest::NS_OK, jsEngine->Evaluate("request.channel.status")->AsInt());
ASSERT_EQ(200, jsEngine->Evaluate("request.status")->AsInt());
« src/Thread.h ('K') | « test/UpdateCheck.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld