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

Unified Diff: test/filterClasses.js

Issue 29354864: Issue 4223 - Migrate some more of adblockplustests (Closed)
Patch Set: Addressed feedback Created Oct. 4, 2016, 12:04 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/elemHide.js ('k') | test/filterListener.js » ('j') | test_runner.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/filterClasses.js
diff --git a/test/filterClasses.js b/test/filterClasses.js
index a25d7673d0c44e0c3fbf771d400644ef83d00e16..7bb75fc4642226ae0cf5175f0c896b45d1973924 100644
--- a/test/filterClasses.js
+++ b/test/filterClasses.js
@@ -17,11 +17,37 @@
"use strict";
-let {
- Filter, InvalidFilter, CommentFilter, ActiveFilter, RegExpFilter,
- BlockingFilter, WhitelistFilter, ElemHideBase, ElemHideFilter,
- ElemHideException, CSSPropertyFilter
-} = require("../lib/filterClasses");
+let {createSandbox} = require("./_common");
+
+let Filter = null;
+let InvalidFilter = null;
+let CommentFilter = null;
+let ActiveFilter = null;
+let RegExpFilter = null;
+let BlockingFilter = null;
+let WhitelistFilter = null;
+let ElemHideBase = null;
+let ElemHideFilter = null;
+let ElemHideException = null;
+let CSSPropertyFilter = null;
+
+let t = null;
+let defaultTypes = null;
+
+exports.setUp = function(callback)
+{
+ let sandboxedRequire = createSandbox();
+ (
+ {Filter, InvalidFilter, CommentFilter, ActiveFilter, RegExpFilter,
+ BlockingFilter, WhitelistFilter, ElemHideBase, ElemHideFilter,
+ ElemHideException, CSSPropertyFilter} = sandboxedRequire("../lib/filterClasses")
+ );
+ t = RegExpFilter.typeMap;
+ defaultTypes = 0x7FFFFFFF & ~(t.ELEMHIDE | t.DOCUMENT | t.POPUP |
+ t.GENERICHIDE | t.GENERICBLOCK);
+
+ callback();
+};
function serializeFilter(filter)
{
@@ -244,9 +270,6 @@ exports.testFiltersWithState = function(test)
test.done();
};
-let t = RegExpFilter.typeMap;
-let defaultTypes = 0x7FFFFFFF & ~(t.ELEMHIDE | t.DOCUMENT | t.POPUP | t.GENERICHIDE | t.GENERICBLOCK);
-
exports.testSpecialCharacters = function(test)
{
compareFilter(test, "/ddd|f?a[s]d/", ["type=filterlist", "text=/ddd|f?a[s]d/", "regexp=ddd|f?a[s]d"]);
« no previous file with comments | « test/elemHide.js ('k') | test/filterListener.js » ('j') | test_runner.js » ('J')

Powered by Google App Engine
This is Rietveld