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

Unified Diff: chrome/test/data/extensions/api_test/native_bindings/declarative_content/background.js

Issue 2853023002: [Extensions Bindings] Add native declarativeContent verification (Closed)
Patch Set: lazyboy's Created 3 years, 8 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
Index: chrome/test/data/extensions/api_test/native_bindings/declarative_content/background.js
diff --git a/chrome/test/data/extensions/api_test/native_bindings/declarative_content/background.js b/chrome/test/data/extensions/api_test/native_bindings/declarative_content/background.js
index b2fa91496778abb74017ab066e839007cd6c9317..4a15343a685287f64335c3a11f43053455addb6c 100644
--- a/chrome/test/data/extensions/api_test/native_bindings/declarative_content/background.js
+++ b/chrome/test/data/extensions/api_test/native_bindings/declarative_content/background.js
@@ -8,12 +8,15 @@
const kRuleId = 'rule1';
+var imageData = new ImageData(19, 19);
+
var rule = {
conditions: [
new chrome.declarativeContent.PageStateMatcher(
{pageUrl: {hostPrefix: 'example'}}),
], actions: [
new chrome.declarativeContent.ShowPageAction(),
+ new chrome.declarativeContent.SetIcon({imageData: imageData}),
],
id: kRuleId,
};
@@ -34,3 +37,24 @@ chrome.declarativeContent.onPageChanged.addRules([rule], function() {
chrome.test.sendMessage('ready');
});
});
+
+function didThrow(func) {
+ var caught = false;
+ try {
+ func();
+ } catch (e) {
+ caught = true;
+ }
+ return caught;
+}
+
+chrome.test.runTests([
+ function validationCheck() {
+ // Test that type constructions are properly validated.
+ chrome.test.assertTrue(didThrow(function() {
+ var matcher = new chrome.declarativeContent.PageStateMatcher(
+ {pageUrl: {fake: 'bogus'}});
+ }));
+ chrome.test.succeed();
+ },
+]);
« no previous file with comments | « chrome/renderer/resources/extensions/declarative_content_custom_bindings.js ('k') | extensions/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698