Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/product-registry-impl-register-sanity.js

Issue 2875463002: [Devtools] Added sanity check for product registry's register function (Closed)
Patch Set: a Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-unit/product-registry-impl-register-sanity-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/inspector-unit/product-registry-impl-register-sanity.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-unit/product-registry-impl-register-sanity.js b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/product-registry-impl-register-sanity.js
new file mode 100644
index 0000000000000000000000000000000000000000..a29894b406c562980874e30d2c9e487190dc5a70
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/product-registry-impl-register-sanity.js
@@ -0,0 +1,63 @@
+
+TestRunner.loadLazyModules(['product_registry_impl']).then(test);
+function test() {
+ TestRunner.addResult("This tests product registry impl's register function.");
+
+ resetProductRegistry();
+ ProductRegistryImpl.register([
+ "example.(com|org)",
+ "*.example.com",
+ "test-*.example.com",
+ "subdomain.example.com"
+ ], [
+ {
+ hash: "0caaf24ab1a0c334", // Result of: sha1('example.com').substr(0, 16).
+ prefixes: {
+ "": {
+ product: 0 // Reference to index of first argument of ProductRegistryImpl.register.
+ },
+ "*": {
+ product: 1
+ },
+ "test-": {
+ product: 2
+ }
+ }
+ },
+ {
+ hash: "20116dfd6774a9e7", // Result of: sha1('example.org').substr(0, 16).
+ prefixes: {
+ "": {
+ product: 0
+ }
+ }
+ },
+ {
+ hash: "e3d90251f85e2064", // Result of: sha1('subdomain.example.com').substr(0, 16).
+ prefixes: {
+ "": {
+ product: 3
+ }
+ }
+ }
+ ]);
+ var instance = new ProductRegistryImpl.Registry();
+
+ logDomainEntry('example.com');
+ logDomainEntry('wild.example.com');
+ logDomainEntry('test-1.example.com');
+ logDomainEntry('subdomain.example.com');
+ logDomainEntry('example.org');
+ logDomainEntry('chromium.org');
+
+ TestRunner.completeTest();
+
+ function logDomainEntry(domainStr) {
+ TestRunner.addResult("Testing: " + domainStr + " -> " + instance.nameForUrl(('http://' + domainStr).asParsedURL()));
+ }
+
+ function resetProductRegistry() {
+ TestRunner.addResult("Cleared ProductRegistryImpl");
+ ProductRegistryImpl._productsByDomainHash.clear();
+ }
+}
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-unit/product-registry-impl-register-sanity-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698