| LEFT | RIGHT | 
|---|
| 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 | 
| 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 12  * GNU General Public License for more details. | 12  * GNU General Public License for more details. | 
| 13  * | 13  * | 
| 14  * You should have received a copy of the GNU General Public License | 14  * You should have received a copy of the GNU General Public License | 
| 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
| 16  */ | 16  */ | 
| 17 | 17 | 
| 18 "use strict"; | 18 "use strict"; | 
| 19 | 19 | 
| 20 let {createSandbox} = require("common"); | 20 let {createSandbox} = require("./_common"); | 
| 21 let sandboxedRequire = createSandbox(); |  | 
| 22 | 21 | 
| 23 let { | 22 let Subscription = null; | 
| 24   Subscription, SpecialSubscription, DownloadableSubscription, | 23 let SpecialSubscription = null; | 
| 25   RegularSubscription, ExternalSubscription | 24 let DownloadableSubscription = null; | 
| 26 } = sandboxedRequire("subscriptionClasses"); | 25 let RegularSubscription = null; | 
|  | 26 let ExternalSubscription = null; | 
|  | 27 | 
|  | 28 exports.setUp = function(callback) | 
|  | 29 { | 
|  | 30   let sandboxedRequire = createSandbox(); | 
|  | 31   ( | 
|  | 32     {Subscription, SpecialSubscription, | 
|  | 33      DownloadableSubscription, RegularSubscription, | 
|  | 34      ExternalSubscription} = sandboxedRequire("../lib/subscriptionClasses") | 
|  | 35   ); | 
|  | 36 | 
|  | 37   callback(); | 
|  | 38 }; | 
| 27 | 39 | 
| 28 function compareSubscription(test, url, expected, postInit) | 40 function compareSubscription(test, url, expected, postInit) | 
| 29 { | 41 { | 
| 30   expected.push("[Subscription]"); | 42   expected.push("[Subscription]"); | 
| 31   let subscription = Subscription.fromURL(url); | 43   let subscription = Subscription.fromURL(url); | 
| 32   if (postInit) | 44   if (postInit) | 
| 33     postInit(subscription); | 45     postInit(subscription); | 
| 34   let result = []; | 46   let result = []; | 
| 35   subscription.serialize(result); | 47   subscription.serialize(result); | 
| 36   test.equal(result.sort().join("\n"), expected.sort().join("\n"), url); | 48   test.equal(result.sort().join("\n"), expected.sort().join("\n"), url); | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 81     subscription.requiredVersion = "0.6"; | 93     subscription.requiredVersion = "0.6"; | 
| 82   }); | 94   }); | 
| 83   compareSubscription(test, "~wl~", ["url=~wl~", "disabled=true", "title=Test gr
     oup"], function(subscription) | 95   compareSubscription(test, "~wl~", ["url=~wl~", "disabled=true", "title=Test gr
     oup"], function(subscription) | 
| 84   { | 96   { | 
| 85     subscription.title = "Test group"; | 97     subscription.title = "Test group"; | 
| 86     subscription.disabled = true; | 98     subscription.disabled = true; | 
| 87   }); | 99   }); | 
| 88 | 100 | 
| 89   test.done(); | 101   test.done(); | 
| 90 }; | 102 }; | 
| LEFT | RIGHT | 
|---|