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

Side by Side Diff: chrome/test/data/extensions/api_test/events/background.js

Issue 15091002: Lazily load API schemas from resource files and convert all APIs to features (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos tests Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 chrome.test.runTests([ 5 chrome.test.runTests([
6 // Tests that attaching and detaching to an event for which we don't have
7 // permission acts as expected (e.g. we don't DCHECK!).
8 function attachAndDetachNoPermisssions() {
9 function dummy() {};
10 try {
11 chrome.management.onEnabled.addListener(dummy);
12 chrome.test.fail();
13 } catch (e) {
14 chrome.test.assertTrue(
15 e.message.search("You do not have permission") >= 0,
16 e.message);
17 }
18 chrome.test.assertFalse(chrome.management.onEnabled.hasListeners());
19 // Browser should not DCHECK.
20 chrome.management.onEnabled.removeListener(dummy);
21 chrome.test.succeed();
22 },
23
24 // Tests that attaching a named event twice will fail. 6 // Tests that attaching a named event twice will fail.
25 function doubleAttach() { 7 function doubleAttach() {
26 function dummy() {}; 8 function dummy() {};
27 var onClicked = new chrome.Event("browserAction.onClicked"); 9 var onClicked = new chrome.Event("browserAction.onClicked");
28 var onClicked2 = new chrome.Event("browserAction.onClicked"); 10 var onClicked2 = new chrome.Event("browserAction.onClicked");
29 onClicked.addListener(dummy); 11 onClicked.addListener(dummy);
30 chrome.test.assertTrue(onClicked.hasListeners()); 12 chrome.test.assertTrue(onClicked.hasListeners());
31 try { 13 try {
32 onClicked2.addListener(dummy); 14 onClicked2.addListener(dummy);
33 chrome.test.fail(); 15 chrome.test.fail();
(...skipping 13 matching lines...) Expand all
47 // Tests that 2 pages attaching to the same event does not trigger a DCHECK. 29 // Tests that 2 pages attaching to the same event does not trigger a DCHECK.
48 function twoPageAttach() { 30 function twoPageAttach() {
49 // Test harness should already have opened tab.html, which registers this 31 // Test harness should already have opened tab.html, which registers this
50 // listener. 32 // listener.
51 chrome.browserAction.onClicked.addListener(function() {}); 33 chrome.browserAction.onClicked.addListener(function() {});
52 34
53 // Test continues in twoPageAttach.html. 35 // Test continues in twoPageAttach.html.
54 window.open("twoPageAttach.html"); 36 window.open("twoPageAttach.html");
55 }, 37 },
56 ]); 38 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698