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

Side by Side Diff: chrome/test/data/extensions/api_test/webnavigation/navigation/test.html

Issue 3359013: Revert 58809 - Implement the webNavigation.onCommitted event.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 3 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/webnavigation/navigation/simpleLoad/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
(Empty)
1 <script>
2 var expectedEventData;
3 var capturedEventData;
4
5 function expect(data) {
6 expectedEventData = data;
7 capturedEventData = [];
8 }
9
10 function checkExpectations() {
11 if (capturedEventData.length < expectedEventData.length) {
12 return;
13 }
14 chrome.test.assertEq(JSON.stringify(expectedEventData),
15 JSON.stringify(capturedEventData));
16 chrome.test.succeed();
17 }
18
19 chrome.experimental.webNavigation.onCommitted.addListener(function(details) {
20 console.log('---onCommitted: ' + details.url);
21 // normalize details.
22 details.timeStamp = 0;
23 if (details.frameId != 0) {
24 details.frameId = 1;
25 }
26 capturedEventData.push(details);
27 checkExpectations();
28 });
29
30 var getURL = chrome.extension.getURL;
31 chrome.tabs.getSelected(null, function(tab) {
32 var tabId = tab.id;
33
34 chrome.test.runTests([
35 /* Navigates to an URL */
36 function simpleLoad() {
37 expect([
38 { frameId: 0,
39 tabId: tabId,
40 timeStamp: 0,
41 transitionQualifiers: "",
42 transitionType: "link",
43 url: getURL('simpleLoad/a.html') }]);
44 chrome.tabs.update(tabId, { url: getURL('simpleLoad/a.html') });
45 },
46
47 /* Navigates to a.html that redirects to b.html (using javascript)
48 after a delay of 500ms, so the initial navigation is completed and
49 the redirection is marked as client_redirect */
50 function clientRedirect() {
51 expect([
52 { frameId: 0,
53 tabId: tabId,
54 timeStamp: 0,
55 transitionQualifiers: "",
56 transitionType: "link",
57 url: getURL('clientRedirect/a.html') },
58 { frameId: 0,
59 tabId: tabId,
60 timeStamp: 0,
61 transitionQualifiers: "client_redirect",
62 transitionType: "link",
63 url: getURL('clientRedirect/b.html') }]);
64 chrome.tabs.update(tabId, { url: getURL('clientRedirect/a.html') });
65 },
66
67 /* First navigates to a.html which redirects to to b.html which uses
68 history.back() to navigate back to a.html */
69 function forwardBack() {
70 expect([
71 { frameId: 0,
72 tabId: tabId,
73 timeStamp: 0,
74 transitionQualifiers: "",
75 transitionType: "link",
76 url: getURL('forwardBack/a.html') },
77 { frameId: 0,
78 tabId: tabId,
79 timeStamp: 0,
80 transitionQualifiers: "client_redirect",
81 transitionType: "link",
82 url: getURL('forwardBack/b.html') },
83 { frameId: 0,
84 tabId: tabId,
85 timeStamp: 0,
86 transitionQualifiers: "forward_back",
87 transitionType: "link",
88 url: getURL('forwardBack/a.html') }]);
89 chrome.tabs.update(tabId, { url: getURL('forwardBack/a.html') });
90 },
91
92 /* Navigates to a.html which includes b.html as an iframe. b.html
93 redirects to c.html. Note that all navigation entries are for
94 a.html. Also, b.html does not generate a navigation entry. */
95 function iframe() {
96 expect([
97 { frameId: 0,
98 tabId: tabId,
99 timeStamp: 0,
100 transitionQualifiers: "",
101 transitionType: "link",
102 url: getURL('iframe/a.html') },
103 { frameId: 1,
104 tabId: tabId,
105 timeStamp: 0,
106 transitionQualifiers: "",
107 transitionType: "link",
108 url: getURL('iframe/a.html') }]);
109 chrome.tabs.update(tabId, { url: getURL('iframe/a.html') });
110 },
111 ]);
112 });
113 </script>
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/webnavigation/navigation/simpleLoad/a.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698