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

Side by Side Diff: chrome/test/data/extensions/api_test/tabs/on_updated/test.js

Issue 12591008: Trigger a tab updated event if the favicon URL changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove favicon.ico (was committed separately). Created 7 years, 9 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
« no previous file with comments | « chrome/test/data/extensions/api_test/tabs/on_updated/favicon/a.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 var expectedEventData; 5 var expectedEventData;
6 var capturedEventData; 6 var capturedEventData;
7 var shouldIgnore; 7 var shouldIgnore;
8 8
9 function expect(data, ignoreFunc) { 9 function expect(data, ignoreFunc) {
10 expectedEventData = data; 10 expectedEventData = data;
11 capturedEventData = []; 11 capturedEventData = [];
12 shouldIgnore = ignoreFunc; 12 shouldIgnore = ignoreFunc;
13 } 13 }
14 14
15 function checkExpectations() { 15 function checkExpectations() {
16 if (capturedEventData.length < expectedEventData.length) { 16 if (capturedEventData.length < expectedEventData.length) {
17 return; 17 return;
18 } 18 }
19 chrome.test.assertEq(JSON.stringify(expectedEventData), 19 chrome.test.assertEq(JSON.stringify(expectedEventData),
20 JSON.stringify(capturedEventData)); 20 JSON.stringify(capturedEventData));
21 chrome.test.succeed(); 21 chrome.test.succeed();
22 } 22 }
23 23
24 var getURL = chrome.extension.getURL; 24 var getURL = chrome.extension.getURL;
25 25
26 chrome.tabs.onUpdated.addListener(function(tabId, info, tab) { 26 chrome.tabs.onUpdated.addListener(function(tabId, info, tab) {
27 console.log('---onUpdated: ' + info.status + ', ' + info.url); 27 console.log('---onUpdated: ' + info.status + ', ' + info.url + '. ' +
28 info.favIconUrl);
28 if (shouldIgnore && shouldIgnore(info)) { 29 if (shouldIgnore && shouldIgnore(info)) {
29 return; 30 return;
30 } 31 }
31 capturedEventData.push(info); 32 capturedEventData.push(info);
32 checkExpectations(); 33 checkExpectations();
33 }); 34 });
34 35
35 chrome.test.runTests([ 36 chrome.test.runTests([
36 function browserThenRendererInitiated() { 37 function browserThenRendererInitiated() {
37 // Note that a.html will set it's location.href to b.html, creating a 38 // Note that a.html will set it's location.href to b.html, creating a
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 102
102 function internalAnchorNavigated() { 103 function internalAnchorNavigated() {
103 expect([ 104 expect([
104 { status: 'loading', url: getURL('internalAnchorNavigated/a.html') }, 105 { status: 'loading', url: getURL('internalAnchorNavigated/a.html') },
105 { status: 'complete' }, 106 { status: 'complete' },
106 { status: 'loading', url: getURL('internalAnchorNavigated/a.html#b') }, 107 { status: 'loading', url: getURL('internalAnchorNavigated/a.html#b') },
107 { status: 'complete' }, 108 { status: 'complete' },
108 ]); 109 ]);
109 110
110 chrome.tabs.create({ url: getURL('internalAnchorNavigated/a.html') }); 111 chrome.tabs.create({ url: getURL('internalAnchorNavigated/a.html') });
112 },
113
114 function faviconLoaded() {
115 expect([
116 { status: 'loading', url: getURL('favicon/a.html') },
117 { status: 'complete' },
118 { favIconUrl: getURL('favicon/favicon.ico') },
119 ]);
120
121 chrome.tabs.create({ url: getURL('favicon/a.html') });
111 } 122 }
112 ]); 123 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/tabs/on_updated/favicon/a.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698