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

Unified Diff: chrome/test/data/extensions/api_test/bookmarks/test.js

Issue 3672003: fix bookmarks API crash when handling invalid URL (Closed)
Patch Set: missing semicolon Created 10 years, 2 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 | « chrome/renderer/resources/extension_apitest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/bookmarks/test.js
diff --git a/chrome/test/data/extensions/api_test/bookmarks/test.js b/chrome/test/data/extensions/api_test/bookmarks/test.js
index ce8db8cba5742ef4ab679d1de879d1792a50a36c..13eb646af87660ee820afb22758e359cffc1a51a 100644
--- a/chrome/test/data/extensions/api_test/bookmarks/test.js
+++ b/chrome/test/data/extensions/api_test/bookmarks/test.js
@@ -222,7 +222,7 @@ chrome.test.runTests([
node3.parentId = results.parentId;
node3.index = 1;
node2.index = 2;
-
+
// update expected to match
expected[0].children[0].children.pop();
expected[0].children[0].children.pop();
@@ -283,11 +283,33 @@ chrome.test.runTests([
chrome.test.assertEq(title, results.title);
}));
- var url = "http://example.com/hello"
+ var url = "http://example.com/hello";
chrome.bookmarks.update(node1.id, {"url": url}, pass(function(results) {
// Make sure that leaving out the title does not set the title to empty.
chrome.test.assertEq(title, results.title);
chrome.test.assertEq(url, results.url);
+
+ // Empty or invalid URLs should not change the URL.
+ var bad_url = "";
+ chrome.bookmarks.update(node1.id, {"url": bad_url},
+ pass(function(results) {
+ chrome.bookmarks.get(node1.id, pass(function(results) {
+ chrome.test.assertEq(url, results[0].url);
+ chrome.test.log("URL UNCHANGED");
+ }));
+ })
+ );
+
+ // Invalid URLs also generate an error.
+ bad_url = "I am not an URL";
+ chrome.bookmarks.update(node1.id, {"url": bad_url}, fail("Invalid URL.",
+ function(results) {
+ chrome.bookmarks.get(node1.id, pass(function(results) {
+ chrome.test.assertEq(url, results[0].url);
+ chrome.test.log("URL UNCHANGED");
+ }));
+ })
+ );
}));
},
« no previous file with comments | « chrome/renderer/resources/extension_apitest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698