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

Delta Between Two Patch Sets: test/JsEngine.cpp

Issue 29442722: Issue 3593 - stop sharing v8::Isolate among tests (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Left Patch Set: address comments Created May 22, 2017, 8:06 a.m.
Right Patch Set: address comments Created May 26, 2017, 10:54 a.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/BaseJsTest.cpp ('k') | no next file » | 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 TEST(NewJsEngineTest, MemoryLeak_NoCircularReferences) 191 TEST(NewJsEngineTest, MemoryLeak_NoCircularReferences)
192 { 192 {
193 std::weak_ptr<AdblockPlus::JsEngine> weakJsEngine; 193 std::weak_ptr<AdblockPlus::JsEngine> weakJsEngine;
194 { 194 {
195 weakJsEngine = AdblockPlus::JsEngine::New(); 195 weakJsEngine = AdblockPlus::JsEngine::New();
196 } 196 }
197 EXPECT_FALSE(weakJsEngine.lock()); 197 EXPECT_FALSE(weakJsEngine.lock());
198 } 198 }
199 199
200 TEST(NewJsEngineTest, MemoryLeak_NoLeak) 200 #if UINTPTR_MAX == UINT32_MAX // detection of 32-bit platform
201 static_assert(sizeof(intptr_t) == 4, "It should be 32bit platform");
202 TEST(NewJsEngineTest, 32bitsOnly_MemoryLeak_NoLeak)
203 #else
204 TEST(NewJsEngineTest, DISABLED_32bitsOnly_MemoryLeak_NoLeak)
205 #endif
201 { 206 {
202 // v8::Isolate by default requires 32MB (depends on platform), so if there is 207 // v8::Isolate by default requires 32MB (depends on platform), so if there is
203 // a memory leak than we will run out of memory on 32 bit platform because it 208 // a memory leak than we will run out of memory on 32 bit platform because it
204 // will allocate 32000 MB which is less than 2GB where it reaches out of 209 // will allocate 32000 MB which is less than 2GB where it reaches out of
205 // memory. Even on android where it allocates initially 16MB, the test still 210 // memory. Even on android where it allocates initially 16MB, the test still
206 // makes sense. 211 // makes sense.
207 for (int i = 0; i < 1000; ++i) 212 for (int i = 0; i < 1000; ++i)
208 { 213 {
209 AdblockPlus::JsEngine::New(); 214 AdblockPlus::JsEngine::New();
210 } 215 }
211 } 216 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld