Index: test/WebRequest.cpp |
diff --git a/test/WebRequest.cpp b/test/WebRequest.cpp |
index 8ee5806beab6db5b6896ce99a2260b89d274668f..9e9b0b790284f9c6a757ae7a424dcc46ba6d0106 100644 |
--- a/test/WebRequest.cpp |
+++ b/test/WebRequest.cpp |
@@ -44,7 +44,7 @@ namespace |
AdblockPlus::Sleep(50); |
AdblockPlus::ServerResponse result; |
- result.status = NS_OK; |
+ result.status = IWebRequest::NS_OK; |
result.responseStatus = 123; |
result.responseHeaders.push_back(std::pair<std::string, std::string>("Foo", "Bar")); |
result.responseText = url + "\n"; |
@@ -92,7 +92,7 @@ namespace |
}; |
typedef WebRequestTest<MockWebRequest> MockWebRequestTest; |
- typedef WebRequestTest<AdblockPlus::DefaultWebRequest> DefaultWebRequestTest; |
+ typedef WebRequestTest<AdblockPlus::DefaultWebRequestSync> DefaultWebRequestTest; |
typedef WebRequestTest<MockWebRequest> XMLHttpRequestTest; |
// we return the url of the XHR. |
@@ -142,7 +142,7 @@ TEST_F(MockWebRequestTest, SuccessfulRequest) |
jsEngine->Evaluate("_webRequest.GET('http://example.com/', {X: 'Y'}, function(result) {foo = result;} )"); |
ASSERT_TRUE(jsEngine->Evaluate("this.foo").IsUndefined()); |
AdblockPlus::Sleep(200); |
- ASSERT_EQ(AdblockPlus::WebRequest::NS_OK, jsEngine->Evaluate("foo.status").AsInt()); |
+ ASSERT_EQ(IWebRequest::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()); |
ASSERT_EQ("{\"Foo\":\"Bar\"}", jsEngine->Evaluate("JSON.stringify(foo.responseHeaders)").AsString()); |
@@ -156,7 +156,7 @@ TEST_F(DefaultWebRequestTest, RealWebRequest) |
jsEngine->Evaluate("_webRequest.GET('https://easylist-downloads.adblockplus.org/easylist.txt', {}, function(result) {foo = result;} )"); |
WaitForVariable("this.foo", jsEngine); |
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()); |
+ ASSERT_EQ(IWebRequest::NS_OK, jsEngine->Evaluate("foo.status").AsInt()); |
ASSERT_EQ(200, jsEngine->Evaluate("foo.responseStatus").AsInt()); |
ASSERT_EQ("[Adblock Plus ", jsEngine->Evaluate("foo.responseText.substr(0, 14)").AsString()); |
ASSERT_EQ("text/plain", jsEngine->Evaluate("foo.responseHeaders['content-type'].substr(0, 10)").AsString()); |
@@ -176,7 +176,7 @@ TEST_F(DefaultWebRequestTest, XMLHttpRequest) |
request.setRequestHeader('X2', 'Y2');\ |
request.send(null);"); |
WaitForVariable("result", jsEngine); |
- ASSERT_EQ(AdblockPlus::WebRequest::NS_OK, jsEngine->Evaluate("request.channel.status").AsInt()); |
+ ASSERT_EQ(IWebRequest::NS_OK, jsEngine->Evaluate("request.channel.status").AsInt()); |
ASSERT_EQ(200, jsEngine->Evaluate("request.status").AsInt()); |
ASSERT_EQ("[Adblock Plus ", jsEngine->Evaluate("result.substr(0, 14)").AsString()); |
ASSERT_EQ("text/plain", jsEngine->Evaluate("request.getResponseHeader('Content-Type').substr(0, 10)").AsString()); |
@@ -190,7 +190,7 @@ TEST_F(DefaultWebRequestTest, DummyWebRequest) |
{ |
jsEngine->Evaluate("_webRequest.GET('https://easylist-downloads.adblockplus.org/easylist.txt', {}, function(result) {foo = result;} )"); |
WaitForVariable("this.foo", jsEngine); |
- ASSERT_EQ(AdblockPlus::WebRequest::NS_ERROR_FAILURE, jsEngine->Evaluate("foo.status").AsInt()); |
+ ASSERT_EQ(IWebRequest::NS_ERROR_FAILURE, jsEngine->Evaluate("foo.status").AsInt()); |
ASSERT_EQ(0, jsEngine->Evaluate("foo.responseStatus").AsInt()); |
ASSERT_EQ("", jsEngine->Evaluate("foo.responseText").AsString()); |
ASSERT_EQ("{}", jsEngine->Evaluate("JSON.stringify(foo.responseHeaders)").AsString()); |
@@ -205,7 +205,7 @@ TEST_F(DefaultWebRequestTest, XMLHttpRequest) |
request.setRequestHeader('X', 'Y');\ |
request.send(null);"); |
WaitForVariable("result", jsEngine); |
- ASSERT_EQ(AdblockPlus::WebRequest::NS_ERROR_FAILURE, jsEngine->Evaluate("request.channel.status").AsInt()); |
+ ASSERT_EQ(IWebRequest::NS_ERROR_FAILURE, jsEngine->Evaluate("request.channel.status").AsInt()); |
ASSERT_EQ(0, jsEngine->Evaluate("request.status").AsInt()); |
ASSERT_EQ("error", jsEngine->Evaluate("result").AsString()); |
ASSERT_TRUE(jsEngine->Evaluate("request.getResponseHeader('Content-Type')").IsNull()); |