diff options
Diffstat (limited to 'chrome')
40 files changed, 210 insertions, 840 deletions
diff --git a/chrome/browser/extensions/extension_webnavigation_apitest.cc b/chrome/browser/extensions/extension_webnavigation_apitest.cc index a1060e0..db52ec4 100644 --- a/chrome/browser/extensions/extension_webnavigation_apitest.cc +++ b/chrome/browser/extensions/extension_webnavigation_apitest.cc @@ -18,7 +18,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigation) { FrameNavigationState::set_allow_extension_scheme(true); - ASSERT_TRUE(RunExtensionTest("webnavigation/api")) << message_; + ASSERT_TRUE( + RunExtensionSubtest("webnavigation", "test_api.html")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationClientRedirect) { @@ -27,7 +28,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationClientRedirect) { FrameNavigationState::set_allow_extension_scheme(true); - ASSERT_TRUE(RunExtensionTest("webnavigation/clientRedirect")) << message_; + ASSERT_TRUE( + RunExtensionSubtest("webnavigation", "test_clientRedirect.html")) + << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationForwardBack) { @@ -36,7 +39,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationForwardBack) { FrameNavigationState::set_allow_extension_scheme(true); - ASSERT_TRUE(RunExtensionTest("webnavigation/forwardBack")) << message_; + ASSERT_TRUE( + RunExtensionSubtest("webnavigation", "test_forwardBack.html")) + << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationIFrame) { @@ -45,7 +50,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationIFrame) { FrameNavigationState::set_allow_extension_scheme(true); - ASSERT_TRUE(RunExtensionTest("webnavigation/iframe")) << message_; + ASSERT_TRUE( + RunExtensionSubtest("webnavigation", "test_iframe.html")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationOpenTab) { @@ -54,7 +60,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationOpenTab) { FrameNavigationState::set_allow_extension_scheme(true); - ASSERT_TRUE(RunExtensionTest("webnavigation/openTab")) << message_; + ASSERT_TRUE( + RunExtensionSubtest("webnavigation", "test_openTab.html")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationReferenceFragment) { @@ -63,7 +70,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationReferenceFragment) { FrameNavigationState::set_allow_extension_scheme(true); - ASSERT_TRUE(RunExtensionTest("webnavigation/referenceFragment")) << message_; + ASSERT_TRUE( + RunExtensionSubtest("webnavigation", "test_referenceFragment.html")) + << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationSimpleLoad) { @@ -72,7 +81,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationSimpleLoad) { FrameNavigationState::set_allow_extension_scheme(true); - ASSERT_TRUE(RunExtensionTest("webnavigation/simpleLoad")) << message_; + ASSERT_TRUE( + RunExtensionSubtest("webnavigation", "test_simpleLoad.html")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationFailures) { @@ -81,7 +91,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationFailures) { FrameNavigationState::set_allow_extension_scheme(true); - ASSERT_TRUE(RunExtensionTest("webnavigation/failures")) << message_; + ASSERT_TRUE( + RunExtensionSubtest("webnavigation", "test_failures.html")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationUserAction) { @@ -91,18 +102,19 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationUserAction) { FrameNavigationState::set_allow_extension_scheme(true); // Wait for the extension to set itself up and return control to us. - ASSERT_TRUE(RunExtensionTest("webnavigation/userAction")) << message_; + ASSERT_TRUE( + RunExtensionSubtest("webnavigation", "test_userAction.html")) << message_; ResultCatcher catcher; ExtensionService* service = browser()->profile()->GetExtensionService(); const Extension* extension = service->GetExtensionById(last_loaded_extension_id_, false); - GURL url = extension->GetResourceURL("a.html"); + GURL url = extension->GetResourceURL("userAction/a.html"); ui_test_utils::NavigateToURL(browser(), url); - url = extension->GetResourceURL("b.html"); + url = extension->GetResourceURL("userAction/b.html"); // This corresponds to "Open link in new tab". browser()->GetSelectedTabContents()->OpenURL( url, GURL(), NEW_BACKGROUND_TAB, PageTransition::LINK); diff --git a/chrome/test/data/extensions/api_test/webnavigation/api/manifest.json b/chrome/test/data/extensions/api_test/webnavigation/api/manifest.json deleted file mode 100644 index 8f33713..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/api/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "api", - "version": "1.0", - "description": "Tests that the webNavigation API exists.", - "permissions": ["experimental"], - "background_page": "test.html" -} diff --git a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/framework.js b/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/framework.js deleted file mode 100644 index 974e459..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/framework.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var expectedEventData; -var capturedEventData; -var nextFrameId; -var frameIds; -var nextTabId; -var tabIds; - -function expect(data) { - expectedEventData = data; - capturedEventData = []; - nextFrameId = 1; - frameIds = {}; - nextTabId = 0; - tabIds = {}; -} - -function checkExpectations() { - if (capturedEventData.length < expectedEventData.length) { - return; - } - chrome.test.assertEq(JSON.stringify(expectedEventData), - JSON.stringify(capturedEventData)); - chrome.test.succeed(); -} - -function captureEvent(name, details) { - // normalize details. - if ('timeStamp' in details) { - details.timeStamp = 0; - } - if (('frameId' in details) && (details.frameId != 0)) { - if (frameIds[details.frameId] === undefined) { - frameIds[details.frameId] = nextFrameId++; - } - details.frameId = frameIds[details.frameId]; - } - if ('tabId' in details) { - if (tabIds[details.tabId] === undefined) { - tabIds[details.tabId] = nextTabId++; - } - details.tabId = tabIds[details.tabId]; - } - if ('sourceTabId' in details) { - if (tabIds[details.sourceTabId] === undefined) { - tabIds[details.sourceTabId] = nextTabId++; - } - details.sourceTabId = tabIds[details.sourceTabId]; - } - capturedEventData.push([name, details]); - checkExpectations(); -} - -chrome.experimental.webNavigation.onBeforeNavigate.addListener( - function(details) { - captureEvent("onBeforeNavigate", details); -}); - -chrome.experimental.webNavigation.onCommitted.addListener(function(details) { - captureEvent("onCommitted", details); -}); - -chrome.experimental.webNavigation.onDOMContentLoaded.addListener( - function(details) { - captureEvent("onDOMContentLoaded", details); -}); - -chrome.experimental.webNavigation.onCompleted.addListener( - function(details) { - captureEvent("onCompleted", details); -}); - -chrome.experimental.webNavigation.onBeforeRetarget.addListener( - function(details) { - captureEvent("onBeforeRetarget", details); -}); - -chrome.experimental.webNavigation.onErrorOccurred.addListener( - function(details) { - captureEvent("onErrorOccurred", details); -}); diff --git a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/manifest.json b/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/manifest.json deleted file mode 100644 index c04d232..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "navigation1", - "version": "1.0", - "description": "Tests the webNavigation API events (part 1).", - "permissions": ["experimental", "tabs"], - "background_page": "test.html" -} diff --git a/chrome/test/data/extensions/api_test/webnavigation/failures/framework.js b/chrome/test/data/extensions/api_test/webnavigation/failures/framework.js deleted file mode 100644 index 974e459..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/failures/framework.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var expectedEventData; -var capturedEventData; -var nextFrameId; -var frameIds; -var nextTabId; -var tabIds; - -function expect(data) { - expectedEventData = data; - capturedEventData = []; - nextFrameId = 1; - frameIds = {}; - nextTabId = 0; - tabIds = {}; -} - -function checkExpectations() { - if (capturedEventData.length < expectedEventData.length) { - return; - } - chrome.test.assertEq(JSON.stringify(expectedEventData), - JSON.stringify(capturedEventData)); - chrome.test.succeed(); -} - -function captureEvent(name, details) { - // normalize details. - if ('timeStamp' in details) { - details.timeStamp = 0; - } - if (('frameId' in details) && (details.frameId != 0)) { - if (frameIds[details.frameId] === undefined) { - frameIds[details.frameId] = nextFrameId++; - } - details.frameId = frameIds[details.frameId]; - } - if ('tabId' in details) { - if (tabIds[details.tabId] === undefined) { - tabIds[details.tabId] = nextTabId++; - } - details.tabId = tabIds[details.tabId]; - } - if ('sourceTabId' in details) { - if (tabIds[details.sourceTabId] === undefined) { - tabIds[details.sourceTabId] = nextTabId++; - } - details.sourceTabId = tabIds[details.sourceTabId]; - } - capturedEventData.push([name, details]); - checkExpectations(); -} - -chrome.experimental.webNavigation.onBeforeNavigate.addListener( - function(details) { - captureEvent("onBeforeNavigate", details); -}); - -chrome.experimental.webNavigation.onCommitted.addListener(function(details) { - captureEvent("onCommitted", details); -}); - -chrome.experimental.webNavigation.onDOMContentLoaded.addListener( - function(details) { - captureEvent("onDOMContentLoaded", details); -}); - -chrome.experimental.webNavigation.onCompleted.addListener( - function(details) { - captureEvent("onCompleted", details); -}); - -chrome.experimental.webNavigation.onBeforeRetarget.addListener( - function(details) { - captureEvent("onBeforeRetarget", details); -}); - -chrome.experimental.webNavigation.onErrorOccurred.addListener( - function(details) { - captureEvent("onErrorOccurred", details); -}); diff --git a/chrome/test/data/extensions/api_test/webnavigation/failures/manifest.json b/chrome/test/data/extensions/api_test/webnavigation/failures/manifest.json deleted file mode 100644 index f1c777b..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/failures/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "navigation2", - "version": "1.0", - "description": "Tests the webNavigation API events (part 2).", - "permissions": ["experimental", "tabs"], - "background_page": "test.html" -} diff --git a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/framework.js b/chrome/test/data/extensions/api_test/webnavigation/forwardBack/framework.js deleted file mode 100644 index 974e459..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/framework.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var expectedEventData; -var capturedEventData; -var nextFrameId; -var frameIds; -var nextTabId; -var tabIds; - -function expect(data) { - expectedEventData = data; - capturedEventData = []; - nextFrameId = 1; - frameIds = {}; - nextTabId = 0; - tabIds = {}; -} - -function checkExpectations() { - if (capturedEventData.length < expectedEventData.length) { - return; - } - chrome.test.assertEq(JSON.stringify(expectedEventData), - JSON.stringify(capturedEventData)); - chrome.test.succeed(); -} - -function captureEvent(name, details) { - // normalize details. - if ('timeStamp' in details) { - details.timeStamp = 0; - } - if (('frameId' in details) && (details.frameId != 0)) { - if (frameIds[details.frameId] === undefined) { - frameIds[details.frameId] = nextFrameId++; - } - details.frameId = frameIds[details.frameId]; - } - if ('tabId' in details) { - if (tabIds[details.tabId] === undefined) { - tabIds[details.tabId] = nextTabId++; - } - details.tabId = tabIds[details.tabId]; - } - if ('sourceTabId' in details) { - if (tabIds[details.sourceTabId] === undefined) { - tabIds[details.sourceTabId] = nextTabId++; - } - details.sourceTabId = tabIds[details.sourceTabId]; - } - capturedEventData.push([name, details]); - checkExpectations(); -} - -chrome.experimental.webNavigation.onBeforeNavigate.addListener( - function(details) { - captureEvent("onBeforeNavigate", details); -}); - -chrome.experimental.webNavigation.onCommitted.addListener(function(details) { - captureEvent("onCommitted", details); -}); - -chrome.experimental.webNavigation.onDOMContentLoaded.addListener( - function(details) { - captureEvent("onDOMContentLoaded", details); -}); - -chrome.experimental.webNavigation.onCompleted.addListener( - function(details) { - captureEvent("onCompleted", details); -}); - -chrome.experimental.webNavigation.onBeforeRetarget.addListener( - function(details) { - captureEvent("onBeforeRetarget", details); -}); - -chrome.experimental.webNavigation.onErrorOccurred.addListener( - function(details) { - captureEvent("onErrorOccurred", details); -}); diff --git a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/manifest.json b/chrome/test/data/extensions/api_test/webnavigation/forwardBack/manifest.json deleted file mode 100644 index c04d232..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "navigation1", - "version": "1.0", - "description": "Tests the webNavigation API events (part 1).", - "permissions": ["experimental", "tabs"], - "background_page": "test.html" -} diff --git a/chrome/test/data/extensions/api_test/webnavigation/iframe/framework.js b/chrome/test/data/extensions/api_test/webnavigation/framework.js index 974e459..74c450f 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/iframe/framework.js +++ b/chrome/test/data/extensions/api_test/webnavigation/framework.js @@ -8,6 +8,7 @@ var nextFrameId; var frameIds; var nextTabId; var tabIds; +var initialized = false; function expect(data) { expectedEventData = data; @@ -16,6 +17,7 @@ function expect(data) { frameIds = {}; nextTabId = 0; tabIds = {}; + initListeners(); } function checkExpectations() { @@ -54,31 +56,32 @@ function captureEvent(name, details) { checkExpectations(); } -chrome.experimental.webNavigation.onBeforeNavigate.addListener( - function(details) { +function initListeners() { + if (initialized) + return; + initialized = true; + chrome.experimental.webNavigation.onBeforeNavigate.addListener( + function(details) { captureEvent("onBeforeNavigate", details); -}); - -chrome.experimental.webNavigation.onCommitted.addListener(function(details) { - captureEvent("onCommitted", details); -}); - -chrome.experimental.webNavigation.onDOMContentLoaded.addListener( - function(details) { + }); + chrome.experimental.webNavigation.onCommitted.addListener( + function(details) { + captureEvent("onCommitted", details); + }); + chrome.experimental.webNavigation.onDOMContentLoaded.addListener( + function(details) { captureEvent("onDOMContentLoaded", details); -}); - -chrome.experimental.webNavigation.onCompleted.addListener( - function(details) { + }); + chrome.experimental.webNavigation.onCompleted.addListener( + function(details) { captureEvent("onCompleted", details); -}); - -chrome.experimental.webNavigation.onBeforeRetarget.addListener( - function(details) { + }); + chrome.experimental.webNavigation.onBeforeRetarget.addListener( + function(details) { captureEvent("onBeforeRetarget", details); -}); - -chrome.experimental.webNavigation.onErrorOccurred.addListener( - function(details) { + }); + chrome.experimental.webNavigation.onErrorOccurred.addListener( + function(details) { captureEvent("onErrorOccurred", details); -}); + }); +} diff --git a/chrome/test/data/extensions/api_test/webnavigation/iframe/manifest.json b/chrome/test/data/extensions/api_test/webnavigation/iframe/manifest.json deleted file mode 100644 index c04d232..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/iframe/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "navigation1", - "version": "1.0", - "description": "Tests the webNavigation API events (part 1).", - "permissions": ["experimental", "tabs"], - "background_page": "test.html" -} diff --git a/chrome/test/data/extensions/api_test/webnavigation/manifest.json b/chrome/test/data/extensions/api_test/webnavigation/manifest.json new file mode 100644 index 0000000..f9ed942 --- /dev/null +++ b/chrome/test/data/extensions/api_test/webnavigation/manifest.json @@ -0,0 +1,6 @@ +{ + "name": "webNavigation", + "version": "1.0", + "description": "Tests the webNavigation API events.", + "permissions": ["experimental", "tabs"] +} diff --git a/chrome/test/data/extensions/api_test/webnavigation/openTab/framework.js b/chrome/test/data/extensions/api_test/webnavigation/openTab/framework.js deleted file mode 100644 index 974e459..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/openTab/framework.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var expectedEventData; -var capturedEventData; -var nextFrameId; -var frameIds; -var nextTabId; -var tabIds; - -function expect(data) { - expectedEventData = data; - capturedEventData = []; - nextFrameId = 1; - frameIds = {}; - nextTabId = 0; - tabIds = {}; -} - -function checkExpectations() { - if (capturedEventData.length < expectedEventData.length) { - return; - } - chrome.test.assertEq(JSON.stringify(expectedEventData), - JSON.stringify(capturedEventData)); - chrome.test.succeed(); -} - -function captureEvent(name, details) { - // normalize details. - if ('timeStamp' in details) { - details.timeStamp = 0; - } - if (('frameId' in details) && (details.frameId != 0)) { - if (frameIds[details.frameId] === undefined) { - frameIds[details.frameId] = nextFrameId++; - } - details.frameId = frameIds[details.frameId]; - } - if ('tabId' in details) { - if (tabIds[details.tabId] === undefined) { - tabIds[details.tabId] = nextTabId++; - } - details.tabId = tabIds[details.tabId]; - } - if ('sourceTabId' in details) { - if (tabIds[details.sourceTabId] === undefined) { - tabIds[details.sourceTabId] = nextTabId++; - } - details.sourceTabId = tabIds[details.sourceTabId]; - } - capturedEventData.push([name, details]); - checkExpectations(); -} - -chrome.experimental.webNavigation.onBeforeNavigate.addListener( - function(details) { - captureEvent("onBeforeNavigate", details); -}); - -chrome.experimental.webNavigation.onCommitted.addListener(function(details) { - captureEvent("onCommitted", details); -}); - -chrome.experimental.webNavigation.onDOMContentLoaded.addListener( - function(details) { - captureEvent("onDOMContentLoaded", details); -}); - -chrome.experimental.webNavigation.onCompleted.addListener( - function(details) { - captureEvent("onCompleted", details); -}); - -chrome.experimental.webNavigation.onBeforeRetarget.addListener( - function(details) { - captureEvent("onBeforeRetarget", details); -}); - -chrome.experimental.webNavigation.onErrorOccurred.addListener( - function(details) { - captureEvent("onErrorOccurred", details); -}); diff --git a/chrome/test/data/extensions/api_test/webnavigation/openTab/manifest.json b/chrome/test/data/extensions/api_test/webnavigation/openTab/manifest.json deleted file mode 100644 index c04d232..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/openTab/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "navigation1", - "version": "1.0", - "description": "Tests the webNavigation API events (part 1).", - "permissions": ["experimental", "tabs"], - "background_page": "test.html" -} diff --git a/chrome/test/data/extensions/api_test/webnavigation/openTab/test.html b/chrome/test/data/extensions/api_test/webnavigation/openTab/test.html deleted file mode 100644 index a03fe7d..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/openTab/test.html +++ /dev/null @@ -1,5 +0,0 @@ -<script src="tests.js"></script> -<script src="framework.js"></script> -<script> - runTests(); -</script> diff --git a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/framework.js b/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/framework.js deleted file mode 100644 index 974e459..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/framework.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var expectedEventData; -var capturedEventData; -var nextFrameId; -var frameIds; -var nextTabId; -var tabIds; - -function expect(data) { - expectedEventData = data; - capturedEventData = []; - nextFrameId = 1; - frameIds = {}; - nextTabId = 0; - tabIds = {}; -} - -function checkExpectations() { - if (capturedEventData.length < expectedEventData.length) { - return; - } - chrome.test.assertEq(JSON.stringify(expectedEventData), - JSON.stringify(capturedEventData)); - chrome.test.succeed(); -} - -function captureEvent(name, details) { - // normalize details. - if ('timeStamp' in details) { - details.timeStamp = 0; - } - if (('frameId' in details) && (details.frameId != 0)) { - if (frameIds[details.frameId] === undefined) { - frameIds[details.frameId] = nextFrameId++; - } - details.frameId = frameIds[details.frameId]; - } - if ('tabId' in details) { - if (tabIds[details.tabId] === undefined) { - tabIds[details.tabId] = nextTabId++; - } - details.tabId = tabIds[details.tabId]; - } - if ('sourceTabId' in details) { - if (tabIds[details.sourceTabId] === undefined) { - tabIds[details.sourceTabId] = nextTabId++; - } - details.sourceTabId = tabIds[details.sourceTabId]; - } - capturedEventData.push([name, details]); - checkExpectations(); -} - -chrome.experimental.webNavigation.onBeforeNavigate.addListener( - function(details) { - captureEvent("onBeforeNavigate", details); -}); - -chrome.experimental.webNavigation.onCommitted.addListener(function(details) { - captureEvent("onCommitted", details); -}); - -chrome.experimental.webNavigation.onDOMContentLoaded.addListener( - function(details) { - captureEvent("onDOMContentLoaded", details); -}); - -chrome.experimental.webNavigation.onCompleted.addListener( - function(details) { - captureEvent("onCompleted", details); -}); - -chrome.experimental.webNavigation.onBeforeRetarget.addListener( - function(details) { - captureEvent("onBeforeRetarget", details); -}); - -chrome.experimental.webNavigation.onErrorOccurred.addListener( - function(details) { - captureEvent("onErrorOccurred", details); -}); diff --git a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/manifest.json b/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/manifest.json deleted file mode 100644 index c04d232..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "navigation1", - "version": "1.0", - "description": "Tests the webNavigation API events (part 1).", - "permissions": ["experimental", "tabs"], - "background_page": "test.html" -} diff --git a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/test.html b/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/test.html deleted file mode 100644 index a03fe7d..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/test.html +++ /dev/null @@ -1,5 +0,0 @@ -<script src="tests.js"></script> -<script src="framework.js"></script> -<script> - runTests(); -</script> diff --git a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/framework.js b/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/framework.js deleted file mode 100644 index 974e459..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/framework.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var expectedEventData; -var capturedEventData; -var nextFrameId; -var frameIds; -var nextTabId; -var tabIds; - -function expect(data) { - expectedEventData = data; - capturedEventData = []; - nextFrameId = 1; - frameIds = {}; - nextTabId = 0; - tabIds = {}; -} - -function checkExpectations() { - if (capturedEventData.length < expectedEventData.length) { - return; - } - chrome.test.assertEq(JSON.stringify(expectedEventData), - JSON.stringify(capturedEventData)); - chrome.test.succeed(); -} - -function captureEvent(name, details) { - // normalize details. - if ('timeStamp' in details) { - details.timeStamp = 0; - } - if (('frameId' in details) && (details.frameId != 0)) { - if (frameIds[details.frameId] === undefined) { - frameIds[details.frameId] = nextFrameId++; - } - details.frameId = frameIds[details.frameId]; - } - if ('tabId' in details) { - if (tabIds[details.tabId] === undefined) { - tabIds[details.tabId] = nextTabId++; - } - details.tabId = tabIds[details.tabId]; - } - if ('sourceTabId' in details) { - if (tabIds[details.sourceTabId] === undefined) { - tabIds[details.sourceTabId] = nextTabId++; - } - details.sourceTabId = tabIds[details.sourceTabId]; - } - capturedEventData.push([name, details]); - checkExpectations(); -} - -chrome.experimental.webNavigation.onBeforeNavigate.addListener( - function(details) { - captureEvent("onBeforeNavigate", details); -}); - -chrome.experimental.webNavigation.onCommitted.addListener(function(details) { - captureEvent("onCommitted", details); -}); - -chrome.experimental.webNavigation.onDOMContentLoaded.addListener( - function(details) { - captureEvent("onDOMContentLoaded", details); -}); - -chrome.experimental.webNavigation.onCompleted.addListener( - function(details) { - captureEvent("onCompleted", details); -}); - -chrome.experimental.webNavigation.onBeforeRetarget.addListener( - function(details) { - captureEvent("onBeforeRetarget", details); -}); - -chrome.experimental.webNavigation.onErrorOccurred.addListener( - function(details) { - captureEvent("onErrorOccurred", details); -}); diff --git a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/manifest.json b/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/manifest.json deleted file mode 100644 index c04d232..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "navigation1", - "version": "1.0", - "description": "Tests the webNavigation API events (part 1).", - "permissions": ["experimental", "tabs"], - "background_page": "test.html" -} diff --git a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/test.html b/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/test.html deleted file mode 100644 index a03fe7d..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/test.html +++ /dev/null @@ -1,5 +0,0 @@ -<script src="tests.js"></script> -<script src="framework.js"></script> -<script> - runTests(); -</script> diff --git a/chrome/test/data/extensions/api_test/webnavigation/api/test.html b/chrome/test/data/extensions/api_test/webnavigation/test_api.html index 03c70a5..03c70a5 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/api/test.html +++ b/chrome/test/data/extensions/api_test/webnavigation/test_api.html diff --git a/chrome/test/data/extensions/api_test/webnavigation/test_clientRedirect.html b/chrome/test/data/extensions/api_test/webnavigation/test_clientRedirect.html new file mode 100644 index 0000000..e256495 --- /dev/null +++ b/chrome/test/data/extensions/api_test/webnavigation/test_clientRedirect.html @@ -0,0 +1,5 @@ +<script src="test_clientRedirect.js"></script> +<script src="framework.js"></script> +<script> + runTests(); +</script> diff --git a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/tests.js b/chrome/test/data/extensions/api_test/webnavigation/test_clientRedirect.js index a54b718..7ea953f 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_clientRedirect.js @@ -4,7 +4,7 @@ function runTests() { var getURL = chrome.extension.getURL; - chrome.tabs.getSelected(null, function(tab) { + chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; chrome.test.runTests([ // Navigates to a.html that redirects to b.html (using javascript) @@ -17,48 +17,48 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('clientRedirect/a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('a.html') }], + url: getURL('clientRedirect/a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('clientRedirect/a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('clientRedirect/a.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('clientRedirect/b.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: ["client_redirect"], transitionType: "link", - url: getURL('b.html') }], + url: getURL('clientRedirect/b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('clientRedirect/b.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('b.html') }]]); - chrome.tabs.update(tabId, { url: getURL('a.html') }); + url: getURL('clientRedirect/b.html') }]]); + chrome.tabs.update(tabId, { url: getURL('clientRedirect/a.html') }); }, ]); }); diff --git a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/test.html b/chrome/test/data/extensions/api_test/webnavigation/test_failures.html index a03fe7d..7fc4139 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/test.html +++ b/chrome/test/data/extensions/api_test/webnavigation/test_failures.html @@ -1,4 +1,4 @@ -<script src="tests.js"></script> +<script src="test_failures.js"></script> <script src="framework.js"></script> <script> runTests(); diff --git a/chrome/test/data/extensions/api_test/webnavigation/failures/tests.js b/chrome/test/data/extensions/api_test/webnavigation/test_failures.js index 29adca8..9695da8 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/failures/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_failures.js @@ -4,7 +4,7 @@ function runTests() { var getURL = chrome.extension.getURL; - chrome.tabs.getSelected(null, function(tab) { + chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; chrome.test.runTests([ @@ -16,14 +16,14 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('nonexistant.html') }], + url: getURL('failures/nonexistant.html') }], [ "onErrorOccurred", { error: "net::ERR_FILE_NOT_FOUND", frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('nonexistant.html') }]]); - chrome.tabs.update(tabId, { url: getURL('nonexistant.html') }); + url: getURL('failures/nonexistant.html') }]]); + chrome.tabs.update(tabId, { url: getURL('failures/nonexistant.html') }); }, // An page that tries to load an non-existant iframe. @@ -34,37 +34,37 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('d.html') }], + url: getURL('failures/d.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('d.html') }], + url: getURL('failures/d.html') }], [ "onBeforeNavigate", { frameId: 1, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('c.html') }], + url: getURL('failures/c.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('d.html') }], + url: getURL('failures/d.html') }], [ "onErrorOccurred", { error: "net::ERR_FILE_NOT_FOUND", frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('c.html') }], + url: getURL('failures/c.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('d.html') }]]); - chrome.tabs.update(tabId, { url: getURL('d.html') }); + url: getURL('failures/d.html') }]]); + chrome.tabs.update(tabId, { url: getURL('failures/d.html') }); }, // An iframe navigates to a non-existant page. @@ -75,60 +75,60 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('failures/a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('a.html') }], + url: getURL('failures/a.html') }], [ "onBeforeNavigate", { frameId: 1, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('failures/b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('failures/a.html') }], [ "onCommitted", { frameId: 1, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "auto_subframe", - url: getURL('b.html') }], + url: getURL('failures/b.html') }], [ "onDOMContentLoaded", { frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('failures/b.html') }], [ "onCompleted", { frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('failures/b.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('failures/a.html') }], [ "onBeforeNavigate", { frameId: 1, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('c.html') }], + url: getURL('failures/c.html') }], [ "onErrorOccurred", { error: "net::ERR_FILE_NOT_FOUND", frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('c.html') }]]); - chrome.tabs.update(tabId, { url: getURL('a.html') }); + url: getURL('failures/c.html') }]]); + chrome.tabs.update(tabId, { url: getURL('failures/a.html') }); }, ]); }); diff --git a/chrome/test/data/extensions/api_test/webnavigation/test_forwardBack.html b/chrome/test/data/extensions/api_test/webnavigation/test_forwardBack.html new file mode 100644 index 0000000..984b60e --- /dev/null +++ b/chrome/test/data/extensions/api_test/webnavigation/test_forwardBack.html @@ -0,0 +1,5 @@ +<script src="test_forwardBack.js"></script> +<script src="framework.js"></script> +<script> + runTests(); +</script> diff --git a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/tests.js b/chrome/test/data/extensions/api_test/webnavigation/test_forwardBack.js index cb2ff20..e233fd0 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_forwardBack.js @@ -4,7 +4,7 @@ function runTests() { var getURL = chrome.extension.getURL; - chrome.tabs.getSelected(null, function(tab) { + chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; chrome.test.runTests([ @@ -17,71 +17,71 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('forwardBack/a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('a.html') }], + url: getURL('forwardBack/a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('forwardBack/a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('forwardBack/a.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('forwardBack/b.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: ["client_redirect"], transitionType: "link", - url: getURL('b.html') }], + url: getURL('forwardBack/b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('forwardBack/b.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('forwardBack/b.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('forwardBack/a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: ["forward_back"], transitionType: "link", - url: getURL('a.html') }], + url: getURL('forwardBack/a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('forwardBack/a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }]]); - chrome.tabs.update(tabId, { url: getURL('a.html') }); + url: getURL('forwardBack/a.html') }]]); + chrome.tabs.update(tabId, { url: getURL('forwardBack/a.html') }); }, ]); }); diff --git a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/test.html b/chrome/test/data/extensions/api_test/webnavigation/test_iframe.html index a03fe7d..6f076a5 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/test.html +++ b/chrome/test/data/extensions/api_test/webnavigation/test_iframe.html @@ -1,4 +1,4 @@ -<script src="tests.js"></script> +<script src="test_iframe.js"></script> <script src="framework.js"></script> <script> runTests(); diff --git a/chrome/test/data/extensions/api_test/webnavigation/iframe/tests.js b/chrome/test/data/extensions/api_test/webnavigation/test_iframe.js index 1a9e06b..eedebe1 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/iframe/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_iframe.js @@ -4,7 +4,7 @@ function runTests() { var getURL = chrome.extension.getURL; - chrome.tabs.getSelected(null, function(tab) { + chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; chrome.test.runTests([ @@ -17,71 +17,71 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('iframe/a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('a.html') }], + url: getURL('iframe/a.html') }], [ "onBeforeNavigate", { frameId: 1, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('iframe/b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('iframe/a.html') }], [ "onCommitted", { frameId: 1, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "auto_subframe", - url: getURL('b.html') }], + url: getURL('iframe/b.html') }], [ "onDOMContentLoaded", { frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('iframe/b.html') }], [ "onCompleted", { frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('iframe/b.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('iframe/a.html') }], [ "onBeforeNavigate", { frameId: 1, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('c.html') }], + url: getURL('iframe/c.html') }], [ "onCommitted", { frameId: 1, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "manual_subframe", - url: getURL('c.html') }], + url: getURL('iframe/c.html') }], [ "onDOMContentLoaded", { frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('c.html') }], + url: getURL('iframe/c.html') }], [ "onCompleted", { frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('c.html') }]]); - chrome.tabs.update(tabId, { url: getURL('a.html') }); + url: getURL('iframe/c.html') }]]); + chrome.tabs.update(tabId, { url: getURL('iframe/a.html') }); }, // Navigates to d.html which includes e.html and f.html as iframes. To be @@ -94,94 +94,94 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('d.html') }], + url: getURL('iframe/d.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('d.html') }], + url: getURL('iframe/d.html') }], [ "onBeforeNavigate", { frameId: 1, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('e.html') }], + url: getURL('iframe/e.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('d.html') }], + url: getURL('iframe/d.html') }], [ "onCommitted", { frameId: 1, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "auto_subframe", - url: getURL('e.html') }], + url: getURL('iframe/e.html') }], [ "onDOMContentLoaded", { frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('e.html') }], + url: getURL('iframe/e.html') }], [ "onBeforeNavigate", { frameId: 2, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('f.html') }], + url: getURL('iframe/f.html') }], [ "onCompleted", { frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('e.html') }], + url: getURL('iframe/e.html') }], [ "onCommitted", { frameId: 2, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "auto_subframe", - url: getURL('f.html') }], + url: getURL('iframe/f.html') }], [ "onDOMContentLoaded", { frameId: 2, tabId: 0, timeStamp: 0, - url: getURL('f.html') }], + url: getURL('iframe/f.html') }], [ "onCompleted", { frameId: 2, tabId: 0, timeStamp: 0, - url: getURL('f.html') }], + url: getURL('iframe/f.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('d.html') }], + url: getURL('iframe/d.html') }], [ "onBeforeNavigate", { frameId: 2, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('g.html') }], + url: getURL('iframe/g.html') }], [ "onCommitted", { frameId: 2, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "manual_subframe", - url: getURL('g.html') }], + url: getURL('iframe/g.html') }], [ "onDOMContentLoaded", { frameId: 2, tabId: 0, timeStamp: 0, - url: getURL('g.html') }], + url: getURL('iframe/g.html') }], [ "onCompleted", { frameId: 2, tabId: 0, timeStamp: 0, - url: getURL('g.html') }]]); - chrome.tabs.update(tabId, { url: getURL('d.html') }); + url: getURL('iframe/g.html') }]]); + chrome.tabs.update(tabId, { url: getURL('iframe/d.html') }); }, ]); }); diff --git a/chrome/test/data/extensions/api_test/webnavigation/failures/test.html b/chrome/test/data/extensions/api_test/webnavigation/test_openTab.html index a03fe7d..1475312 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/failures/test.html +++ b/chrome/test/data/extensions/api_test/webnavigation/test_openTab.html @@ -1,4 +1,4 @@ -<script src="tests.js"></script> +<script src="test_openTab.js"></script> <script src="framework.js"></script> <script> runTests(); diff --git a/chrome/test/data/extensions/api_test/webnavigation/openTab/tests.js b/chrome/test/data/extensions/api_test/webnavigation/test_openTab.js index 4b810b7..6130ec1 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/openTab/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_openTab.js @@ -4,7 +4,7 @@ function runTests() { var getURL = chrome.extension.getURL; - chrome.tabs.getSelected(null, function(tab) { + chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; chrome.test.runTests([ @@ -16,53 +16,53 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('openTab/a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('a.html') }], + url: getURL('openTab/a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('openTab/a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('openTab/a.html') }], [ "onBeforeRetarget", { sourceTabId: 0, - sourceUrl: getURL('a.html'), + sourceUrl: getURL('openTab/a.html'), timeStamp: 0, - url: getURL('b.html') }], + url: getURL('openTab/b.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 1, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('openTab/b.html') }], [ "onCommitted", { frameId: 0, tabId: 1, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('b.html') }], + url: getURL('openTab/b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 1, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('openTab/b.html') }], [ "onCompleted", { frameId: 0, tabId: 1, timeStamp: 0, - url: getURL('b.html') }]]); - chrome.tabs.update(tabId, { url: getURL('a.html') }); + url: getURL('openTab/b.html') }]]); + chrome.tabs.update(tabId, { url: getURL('openTab/a.html') }); }, // Opens a new tab from javascript within an iframe. @@ -73,76 +73,76 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('c.html') }], + url: getURL('openTab/c.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('c.html') }], + url: getURL('openTab/c.html') }], [ "onBeforeNavigate", { frameId: 1, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('openTab/a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('c.html') }], + url: getURL('openTab/c.html') }], [ "onCommitted", { frameId: 1, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "auto_subframe", - url: getURL('a.html') }], + url: getURL('openTab/a.html') }], [ "onDOMContentLoaded", { frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('openTab/a.html') }], [ "onCompleted", { frameId: 1, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('openTab/a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('c.html') }], + url: getURL('openTab/c.html') }], [ "onBeforeRetarget", { sourceTabId: 0, - sourceUrl: getURL('a.html'), + sourceUrl: getURL('openTab/a.html'), timeStamp: 0, - url: getURL('b.html') }], + url: getURL('openTab/b.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 1, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('openTab/b.html') }], [ "onCommitted", { frameId: 0, tabId: 1, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('b.html') }], + url: getURL('openTab/b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 1, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('openTab/b.html') }], [ "onCompleted", { frameId: 0, tabId: 1, timeStamp: 0, - url: getURL('b.html') }]]); - chrome.tabs.update(tabId, { url: getURL('c.html') }); + url: getURL('openTab/b.html') }]]); + chrome.tabs.update(tabId, { url: getURL('openTab/c.html') }); }, ]); }); diff --git a/chrome/test/data/extensions/api_test/webnavigation/test_referenceFragment.html b/chrome/test/data/extensions/api_test/webnavigation/test_referenceFragment.html new file mode 100644 index 0000000..b705107 --- /dev/null +++ b/chrome/test/data/extensions/api_test/webnavigation/test_referenceFragment.html @@ -0,0 +1,5 @@ +<script src="test_referenceFragment.js"></script> +<script src="framework.js"></script> +<script> + runTests(); +</script> diff --git a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/tests.js b/chrome/test/data/extensions/api_test/webnavigation/test_referenceFragment.js index 9e6966ac..9ba983b 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_referenceFragment.js @@ -4,7 +4,7 @@ function runTests() { var getURL = chrome.extension.getURL; - chrome.tabs.getSelected(null, function(tab) { + chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; chrome.test.runTests([ @@ -16,48 +16,48 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('referenceFragment/a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('a.html') }], + url: getURL('referenceFragment/a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('referenceFragment/a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('referenceFragment/a.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('a.html#anchor') }], + url: getURL('referenceFragment/a.html#anchor') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: ["client_redirect"], transitionType: "link", - url: getURL('a.html#anchor') }], + url: getURL('referenceFragment/a.html#anchor') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html#anchor') }], + url: getURL('referenceFragment/a.html#anchor') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html#anchor') }]]); - chrome.tabs.update(tabId, { url: getURL('a.html') }); + url: getURL('referenceFragment/a.html#anchor') }]]); + chrome.tabs.update(tabId, { url: getURL('referenceFragment/a.html') }); }, ]); }); diff --git a/chrome/test/data/extensions/api_test/webnavigation/iframe/test.html b/chrome/test/data/extensions/api_test/webnavigation/test_simpleLoad.html index a03fe7d..ba2236a 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/iframe/test.html +++ b/chrome/test/data/extensions/api_test/webnavigation/test_simpleLoad.html @@ -1,4 +1,4 @@ -<script src="tests.js"></script> +<script src="test_simpleLoad.js"></script> <script src="framework.js"></script> <script> runTests(); diff --git a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/tests.js b/chrome/test/data/extensions/api_test/webnavigation/test_simpleLoad.js index e3d862b..29ce206 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_simpleLoad.js @@ -4,7 +4,7 @@ function runTests() { var getURL = chrome.extension.getURL; - chrome.tabs.getSelected(null, function(tab) { + chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; chrome.test.runTests([ @@ -16,25 +16,25 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('simpleLoad/a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('a.html') }], + url: getURL('simpleLoad/a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('simpleLoad/a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }]]); - chrome.tabs.update(tabId, { url: getURL('a.html') }); + url: getURL('simpleLoad/a.html') }]]); + chrome.tabs.update(tabId, { url: getURL('simpleLoad/a.html') }); }, ]); }); diff --git a/chrome/test/data/extensions/api_test/webnavigation/test_userAction.html b/chrome/test/data/extensions/api_test/webnavigation/test_userAction.html new file mode 100644 index 0000000..5520137 --- /dev/null +++ b/chrome/test/data/extensions/api_test/webnavigation/test_userAction.html @@ -0,0 +1,5 @@ +<script src="test_userAction.js"></script> +<script src="framework.js"></script> +<script> + runTests(); +</script> diff --git a/chrome/test/data/extensions/api_test/webnavigation/userAction/tests.js b/chrome/test/data/extensions/api_test/webnavigation/test_userAction.js index 72f1442..38592de 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/userAction/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/test_userAction.js @@ -4,7 +4,7 @@ function runTests() { var getURL = chrome.extension.getURL; - chrome.tabs.getSelected(null, function(tab) { + chrome.tabs.create({"url": "about:blank"}, function(tab) { var tabId = tab.id; chrome.test.runTests([ @@ -16,52 +16,52 @@ function runTests() { requestId: "0", tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('userAction/a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, timeStamp: 0, transitionQualifiers: [], transitionType: "typed", - url: getURL('a.html') }], + url: getURL('userAction/a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('userAction/a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, timeStamp: 0, - url: getURL('a.html') }], + url: getURL('userAction/a.html') }], [ "onBeforeRetarget", { sourceTabId: 0, - sourceUrl: getURL('a.html'), + sourceUrl: getURL('userAction/a.html'), timeStamp: 0, - url: getURL('b.html') }], + url: getURL('userAction/b.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 1, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('userAction/b.html') }], [ "onCommitted", { frameId: 0, tabId: 1, timeStamp: 0, transitionQualifiers: [], transitionType: "link", - url: getURL('b.html') }], + url: getURL('userAction/b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 1, timeStamp: 0, - url: getURL('b.html') }], + url: getURL('userAction/b.html') }], [ "onCompleted", { frameId: 0, tabId: 1, timeStamp: 0, - url: getURL('b.html') }]]); + url: getURL('userAction/b.html') }]]); // Notify the api test that we're waiting for the user. chrome.test.notifyPass(); diff --git a/chrome/test/data/extensions/api_test/webnavigation/userAction/framework.js b/chrome/test/data/extensions/api_test/webnavigation/userAction/framework.js deleted file mode 100644 index 974e459..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/userAction/framework.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var expectedEventData; -var capturedEventData; -var nextFrameId; -var frameIds; -var nextTabId; -var tabIds; - -function expect(data) { - expectedEventData = data; - capturedEventData = []; - nextFrameId = 1; - frameIds = {}; - nextTabId = 0; - tabIds = {}; -} - -function checkExpectations() { - if (capturedEventData.length < expectedEventData.length) { - return; - } - chrome.test.assertEq(JSON.stringify(expectedEventData), - JSON.stringify(capturedEventData)); - chrome.test.succeed(); -} - -function captureEvent(name, details) { - // normalize details. - if ('timeStamp' in details) { - details.timeStamp = 0; - } - if (('frameId' in details) && (details.frameId != 0)) { - if (frameIds[details.frameId] === undefined) { - frameIds[details.frameId] = nextFrameId++; - } - details.frameId = frameIds[details.frameId]; - } - if ('tabId' in details) { - if (tabIds[details.tabId] === undefined) { - tabIds[details.tabId] = nextTabId++; - } - details.tabId = tabIds[details.tabId]; - } - if ('sourceTabId' in details) { - if (tabIds[details.sourceTabId] === undefined) { - tabIds[details.sourceTabId] = nextTabId++; - } - details.sourceTabId = tabIds[details.sourceTabId]; - } - capturedEventData.push([name, details]); - checkExpectations(); -} - -chrome.experimental.webNavigation.onBeforeNavigate.addListener( - function(details) { - captureEvent("onBeforeNavigate", details); -}); - -chrome.experimental.webNavigation.onCommitted.addListener(function(details) { - captureEvent("onCommitted", details); -}); - -chrome.experimental.webNavigation.onDOMContentLoaded.addListener( - function(details) { - captureEvent("onDOMContentLoaded", details); -}); - -chrome.experimental.webNavigation.onCompleted.addListener( - function(details) { - captureEvent("onCompleted", details); -}); - -chrome.experimental.webNavigation.onBeforeRetarget.addListener( - function(details) { - captureEvent("onBeforeRetarget", details); -}); - -chrome.experimental.webNavigation.onErrorOccurred.addListener( - function(details) { - captureEvent("onErrorOccurred", details); -}); diff --git a/chrome/test/data/extensions/api_test/webnavigation/userAction/manifest.json b/chrome/test/data/extensions/api_test/webnavigation/userAction/manifest.json deleted file mode 100644 index 517cdc5..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/userAction/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "userAction", - "version": "1.0", - "description": "Tests the webNavigation API events.", - "permissions": ["experimental", "tabs"], - "background_page": "test.html" -} diff --git a/chrome/test/data/extensions/api_test/webnavigation/userAction/test.html b/chrome/test/data/extensions/api_test/webnavigation/userAction/test.html deleted file mode 100644 index a03fe7d..0000000 --- a/chrome/test/data/extensions/api_test/webnavigation/userAction/test.html +++ /dev/null @@ -1,5 +0,0 @@ -<script src="tests.js"></script> -<script src="framework.js"></script> -<script> - runTests(); -</script> |