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

Delta Between Two Patch Sets: test/JsEngine.cpp

Issue 29449592: Issue 5183 - Provide async interface for FileSystem (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Rebased. Corrected most of the review issues. Created July 4, 2017, 7:57 p.m.
Right Patch Set: Rebase on master. Last changes. Created July 7, 2017, 1:36 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 | « test/FilterEngine.cpp ('k') | test/Prefs.cpp » ('j') | 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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 TEST(NewJsEngineTest, CallbackGetSet) 165 TEST(NewJsEngineTest, CallbackGetSet)
166 { 166 {
167 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New()); 167 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New());
168 168
169 ASSERT_TRUE(jsEngine->GetLogSystem()); 169 ASSERT_TRUE(jsEngine->GetLogSystem());
170 ASSERT_ANY_THROW(jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr())); 170 ASSERT_ANY_THROW(jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr()));
171 AdblockPlus::LogSystemPtr logSystem(new AdblockPlus::DefaultLogSystem()); 171 AdblockPlus::LogSystemPtr logSystem(new AdblockPlus::DefaultLogSystem());
172 jsEngine->SetLogSystem(logSystem); 172 jsEngine->SetLogSystem(logSystem);
173 ASSERT_EQ(logSystem, jsEngine->GetLogSystem()); 173 ASSERT_EQ(logSystem, jsEngine->GetLogSystem());
174
175 ASSERT_TRUE(jsEngine->GetAsyncFileSystem());
sergei 2017/07/05 10:03:21 Since it's a private functionality, I think we can
hub 2017/07/06 12:21:52 Done.
176 } 174 }
177 175
178 TEST(NewJsEngineTest, GlobalPropertyTest) 176 TEST(NewJsEngineTest, GlobalPropertyTest)
179 { 177 {
180 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New()); 178 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New());
181 jsEngine->SetGlobalProperty("foo", jsEngine->NewValue("bar")); 179 jsEngine->SetGlobalProperty("foo", jsEngine->NewValue("bar"));
182 auto foo = jsEngine->Evaluate("foo"); 180 auto foo = jsEngine->Evaluate("foo");
183 ASSERT_TRUE(foo.IsString()); 181 ASSERT_TRUE(foo.IsString());
184 ASSERT_EQ(foo.AsString(), "bar"); 182 ASSERT_EQ(foo.AsString(), "bar");
185 } 183 }
(...skipping 17 matching lines...) Expand all
203 // v8::Isolate by default requires 32MB (depends on platform), so if there is 201 // v8::Isolate by default requires 32MB (depends on platform), so if there is
204 // a memory leak than we will run out of memory on 32 bit platform because it 202 // a memory leak than we will run out of memory on 32 bit platform because it
205 // will allocate 32000 MB which is less than 2GB where it reaches out of 203 // will allocate 32000 MB which is less than 2GB where it reaches out of
206 // memory. Even on android where it allocates initially 16MB, the test still 204 // memory. Even on android where it allocates initially 16MB, the test still
207 // makes sense. 205 // makes sense.
208 for (int i = 0; i < 1000; ++i) 206 for (int i = 0; i < 1000; ++i)
209 { 207 {
210 AdblockPlus::JsEngine::New(); 208 AdblockPlus::JsEngine::New();
211 } 209 }
212 } 210 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld