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

Side by Side Diff: test/WebRequest.cpp

Issue 29371607: Issue #3593 - Make isolate a fully internal member of the engine
Patch Set: improve unit tests to go with isolate change Created Jan. 16, 2017, 3:53 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/UpdateCheck.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 25 matching lines...) Expand all
36 } 36 }
37 }; 37 };
38 38
39 template<class T> 39 template<class T>
40 class WebRequestTest : public BaseJsTest 40 class WebRequestTest : public BaseJsTest
41 { 41 {
42 protected: 42 protected:
43 void SetUp() 43 void SetUp()
44 { 44 {
45 BaseJsTest::SetUp(); 45 BaseJsTest::SetUp();
46 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new T)); 46 jsEngine->SetWebRequest(std::make_shared<T>());
47 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new LazyFileSystem)); 47 jsEngine->SetFileSystem(std::make_shared<LazyFileSystem>());
48 } 48 }
49 }; 49 };
50 50
51 typedef WebRequestTest<MockWebRequest> MockWebRequestTest; 51 typedef WebRequestTest<MockWebRequest> MockWebRequestTest;
52 typedef WebRequestTest<AdblockPlus::DefaultWebRequest> DefaultWebRequestTest; 52 typedef WebRequestTest<AdblockPlus::DefaultWebRequest> DefaultWebRequestTest;
53 } 53 }
54 54
55 TEST_F(MockWebRequestTest, BadCall) 55 TEST_F(MockWebRequestTest, BadCall)
56 { 56 {
57 ASSERT_ANY_THROW(jsEngine->Evaluate("_webRequest.GET()")); 57 ASSERT_ANY_THROW(jsEngine->Evaluate("_webRequest.GET()"));
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 { 146 {
147 AdblockPlus::Sleep(200); 147 AdblockPlus::Sleep(200);
148 } while (jsEngine->Evaluate("result")->IsUndefined()); 148 } while (jsEngine->Evaluate("result")->IsUndefined());
149 ASSERT_EQ(AdblockPlus::WebRequest::NS_ERROR_FAILURE, jsEngine->Evaluate("reque st.channel.status")->AsInt()); 149 ASSERT_EQ(AdblockPlus::WebRequest::NS_ERROR_FAILURE, jsEngine->Evaluate("reque st.channel.status")->AsInt());
150 ASSERT_EQ(0, jsEngine->Evaluate("request.status")->AsInt()); 150 ASSERT_EQ(0, jsEngine->Evaluate("request.status")->AsInt());
151 ASSERT_EQ("error", jsEngine->Evaluate("result")->AsString()); 151 ASSERT_EQ("error", jsEngine->Evaluate("result")->AsString());
152 ASSERT_TRUE(jsEngine->Evaluate("request.getResponseHeader('Content-Type')")->I sNull()); 152 ASSERT_TRUE(jsEngine->Evaluate("request.getResponseHeader('Content-Type')")->I sNull());
153 } 153 }
154 154
155 #endif 155 #endif
OLDNEW
« no previous file with comments | « test/UpdateCheck.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld