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()); |