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

Side by Side Diff: chrome/test/data/extensions/api_test/window_open/opener/test.html

Issue 7497024: Add a test for the workaround for bug 89967. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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/window_open/opener/set-name.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
(Empty)
1 <script>
2 chrome.test.runTests([
3 // Tests that even though window.opener is not set when using
4 // chrome.windows.create directly, the same effect can be achieved by creating
5 // a window, giving it a name, and then targetting that window via
6 // window.open().
7 function checkOpener() {
8 // Make sure that we wait for the load callbacks to fire.
9 var testCompleted = chrome.test.callbackAdded();
10 var testWindowId;
11
12 window.onSetNameLoaded = function(testWindow) {
13 // It's not technically required for window.opener to be null when using
14 // chrome.windows.create, but that is the current expected behavior (and
15 // the reason why the window.name/open() workaround is necessary).
16 chrome.test.assertTrue(testWindow.opener == null);
17 window.open('check-opener.html', 'target-window');
18 };
19
20 window.onCheckOpenerLoaded = function(testWindow) {
21 // The opener should now be set...
22 chrome.test.assertTrue(testWindow.opener != null);
23 // ...and the test window should only have one tab (because it was
24 // targetted via the "target-window" name).
25 chrome.tabs.getAllInWindow(
26 testWindowId,
27 chrome.test.callbackPass(function(tabs) {
28 chrome.test.assertEq(1, tabs.length);
29 chrome.test.assertEq(
30 chrome.extension.getURL('check-opener.html'), tabs[0].url);
31 testCompleted();
32 }));
33 };
34
35 chrome.windows.create(
36 {'url': 'set-name.html'},
37 chrome.test.callbackPass(function(win) {
38 testWindowId = win.id;
39 }));
40 }
41 ]);
42 </script>
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/window_open/opener/set-name.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698