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

Side by Side Diff: test/JsEngine.cpp

Issue 29449592: Issue 5183 - Provide async interface for FileSystem (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Updated implementation. Created June 2, 2017, 3:49 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
« lib/init.js ('K') | « test/FilterEngine.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-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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 174
175 ASSERT_TRUE(jsEngine->GetFileSystem()); 175 ASSERT_TRUE(jsEngine->GetFileSystem());
176 ASSERT_ANY_THROW(jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr()));
177 AdblockPlus::FileSystemPtr fileSystem(new AdblockPlus::DefaultFileSystem());
178 jsEngine->SetFileSystem(fileSystem);
179 ASSERT_EQ(fileSystem, jsEngine->GetFileSystem());
180 } 176 }
181 177
182 TEST(NewJsEngineTest, GlobalPropertyTest) 178 TEST(NewJsEngineTest, GlobalPropertyTest)
183 { 179 {
184 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New()); 180 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New());
185 jsEngine->SetGlobalProperty("foo", jsEngine->NewValue("bar")); 181 jsEngine->SetGlobalProperty("foo", jsEngine->NewValue("bar"));
186 auto foo = jsEngine->Evaluate("foo"); 182 auto foo = jsEngine->Evaluate("foo");
187 ASSERT_TRUE(foo.IsString()); 183 ASSERT_TRUE(foo.IsString());
188 ASSERT_EQ(foo.AsString(), "bar"); 184 ASSERT_EQ(foo.AsString(), "bar");
189 } 185 }
(...skipping 17 matching lines...) Expand all
207 // v8::Isolate by default requires 32MB (depends on platform), so if there is 203 // v8::Isolate by default requires 32MB (depends on platform), so if there is
208 // a memory leak than we will run out of memory on 32 bit platform because it 204 // a memory leak than we will run out of memory on 32 bit platform because it
209 // will allocate 32000 MB which is less than 2GB where it reaches out of 205 // will allocate 32000 MB which is less than 2GB where it reaches out of
210 // memory. Even on android where it allocates initially 16MB, the test still 206 // memory. Even on android where it allocates initially 16MB, the test still
211 // makes sense. 207 // makes sense.
212 for (int i = 0; i < 1000; ++i) 208 for (int i = 0; i < 1000; ++i)
213 { 209 {
214 AdblockPlus::JsEngine::New(); 210 AdblockPlus::JsEngine::New();
215 } 211 }
216 } 212 }
OLDNEW
« lib/init.js ('K') | « test/FilterEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld