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

Unified Diff: chrome/test/data/extensions/api_test/tabs/on_updated/test.html

Issue 6369003: New extension API: "tab.socketAddress" (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 11 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/tabs/on_updated/test.html
===================================================================
--- chrome/test/data/extensions/api_test/tabs/on_updated/test.html (revision 71766)
+++ chrome/test/data/extensions/api_test/tabs/on_updated/test.html (working copy)
@@ -23,90 +23,112 @@
var getURL = chrome.extension.getURL;
chrome.tabs.onUpdated.addListener(function(tabId, info, tab) {
- console.log('---onUpdated: ' + info.status + ', ' + info.url);
+ console.log('---onUpdated: status=' + info.status + ', url=' + info.url +
+ ', socketAddress=' + tab.socketAddress);
if (shouldIgnore && shouldIgnore(info)) {
return;
}
+ info.socketAddress = tab.socketAddress; // Makes comparing easier.
capturedEventData.push(info);
checkExpectations();
});
-chrome.test.runTests([
- function browserThenRendererInitiated() {
- // Note that a.html will set it's location.href to b.html, creating a
- // renderer-initiated navigation.
- expect([
- { status: 'loading', url: getURL('browserThenRendererInitiated/a.html') },
- { status: 'complete' },
- { status: 'loading', url: getURL('browserThenRendererInitiated/b.html') },
- { status: 'complete' },
- ]);
+chrome.test.getConfig(function(config) {
+ chrome.test.runTests([
+ function browserThenRendererInitiated() {
+ // Note that a.html will set it's location.href to b.html, creating a
+ // renderer-initiated navigation.
+ expect([
+ { status: 'loading',
+ url: getURL('browserThenRendererInitiated/a.html') },
+ { status: 'complete' },
+ { status: 'loading',
+ url: getURL('browserThenRendererInitiated/b.html') },
+ { status: 'complete' },
+ ]);
- chrome.tabs.create({ url: getURL('browserThenRendererInitiated/a.html') });
- },
+ chrome.tabs.create({
+ url: getURL('browserThenRendererInitiated/a.html') });
+ },
- function newTab() {
- // Test for crbug.com/27208.
- expect([
- { status: 'loading', url: 'chrome://newtab/' },
- { status: 'complete' }
- ]);
+ function newTab() {
+ // Test for crbug.com/27208.
+ expect([
+ { status: 'loading', url: 'chrome://newtab/' },
+ { status: 'complete' }
+ ]);
- chrome.tabs.create({ url: 'chrome://newtab/' });
- },
+ chrome.tabs.create({ url: 'chrome://newtab/' });
+ },
- /*
- // TODO(rafaelw) -- This is disabled because this test is flakey.
- function updateDuringCreateCallback() {
- // Test for crbug.com/27204.
- // We have to ignore anything that comes before the about:blank loading
- // status.
- var ignore = true;
- expect([
- { status: 'loading', url: 'about:blank' },
- { status: 'complete' }
- ], function(info) {
- if (info.status === 'loading' && info.url === 'about:blank') {
- ignore = false;
- }
- return ignore;
- });
+ /*
+ // TODO(rafaelw) -- This is disabled because this test is flakey.
+ function updateDuringCreateCallback() {
+ // Test for crbug.com/27204.
+ // We have to ignore anything that comes before the about:blank loading
+ // status.
+ var ignore = true;
+ expect([
+ { status: 'loading', url: 'about:blank' },
+ { status: 'complete' }
+ ], function(info) {
+ if (info.status === 'loading' && info.url === 'about:blank') {
+ ignore = false;
+ }
+ return ignore;
+ });
- chrome.tabs.create({ url: 'chrome://newtab/' }, function(tab) {
- chrome.tabs.update(tab.id, { url: 'about:blank' });
- });
- }, */
+ chrome.tabs.create({ url: 'chrome://newtab/' }, function(tab) {
+ chrome.tabs.update(tab.id, { url: 'about:blank' });
+ });
+ }, */
- function iframeNavigated() {
- // The sequence of events goes like this:
- // -a.html starts loading
- // -while a.html is loading, iframe1.html (in it's onload) navigates to
- // iframe2.html. This causes the page to continue to be in the loading state
- // so the 'complete' status doesn't fire.
- // -iframe2.html does a setTimeout to navigate itself to iframe3.html. This
- // allows the page to stop loading and the 'complete' status to fire, but
- // when the timeout fires, the pages goes back into the loading state
- // which causes the new status: 'loading' event to fire without having
- // changed the url.
- expect([
- { status: 'loading', url: getURL('iframeNavigated/a.html') },
- { status: 'complete' },
- { status: 'loading' },
- { status: 'complete' },
- ]);
+ function iframeNavigated() {
+ // The sequence of events goes like this:
+ // -a.html starts loading
+ // -while a.html is loading, iframe1.html (in it's onload) navigates to
+ // iframe2.html. This causes the page to continue to be in the loading
+ // state so the 'complete' status doesn't fire.
+ // -iframe2.html does a setTimeout to navigate itself to iframe3.html.
+ // This allows the page to stop loading and the 'complete' status to fire,
+ // but when the timeout fires, the pages goes back into the loading state
+ // which causes the new status: 'loading' event to fire without having
+ // changed the url.
+ expect([
+ { status: 'loading', url: getURL('iframeNavigated/a.html') },
+ { status: 'complete' },
+ { status: 'loading' },
+ { status: 'complete' },
+ ]);
- chrome.tabs.create({ url: getURL('iframeNavigated/a.html') });
- },
-
- function internalAnchorNavigated() {
- expect([
- { status: 'loading', url: getURL('internalAnchorNavigated/a.html') },
- { status: 'complete' },
- { status: 'loading', url: getURL('internalAnchorNavigated/a.html#b') },
- { status: 'complete' },
- ]);
+ chrome.tabs.create({ url: getURL('iframeNavigated/a.html') });
+ },
- chrome.tabs.create({ url: getURL('internalAnchorNavigated/a.html') });
- }
-]);
-</script>
+ function internalAnchorNavigated() {
+ expect([
+ { status: 'loading', url: getURL('internalAnchorNavigated/a.html') },
+ { status: 'complete' },
+ { status: 'loading', url: getURL('internalAnchorNavigated/a.html#b') },
+ { status: 'complete' },
+ ]);
+
+ chrome.tabs.create({ url: getURL('internalAnchorNavigated/a.html') });
+ },
+
+ function getSocketAddress() {
+ function fixPort(url) {
+ return url.replace(/PORT/, config.testServer.port);
+ }
+ var urlA = fixPort("http://a.com:PORT/files/extensions/test_file.html");
+ var sockAddr = fixPort("127.0.0.1:PORT");
+
+ expect([
+ { status: 'loading', url: urlA },
+ { status: 'complete', socketAddress: sockAddr },
+ ]);
+
+ chrome.tabs.create({ url: urlA });
+ }
+ ]);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698