| OLD | NEW |
| 1 HOLA!!! If you dont see the message DONE, then there is an error in the script. | 1 HOLA!!! If you dont see the message DONE, then there is an error in the script. |
| 2 <br> | 2 <br> |
| 3 | 3 |
| 4 <script type="text/javascript"> | 4 <script type="text/javascript"> |
| 5 // This extension registers for all tab and window events, and whenever one | 5 // This extension registers for all tab and window events, and whenever one |
| 6 // is received, it calls postMessage to send it back to the test automation | 6 // is received, it calls postMessage to send it back to the test automation |
| 7 // driver. | 7 // driver. |
| 8 | 8 |
| 9 // Wait for the automation server to create a port so that we can communicate | 9 // Wait for the automation server to create a port so that we can communicate |
| 10 // back to it. | 10 // back to it. |
| 11 var portToAutomation; | 11 var portToAutomation; |
| 12 chrome.self.onConnect.addListener(function(port) { | 12 chrome.self.onConnect.addListener(function(port) { |
| 13 portToAutomation = port; | 13 portToAutomation = port; |
| 14 portToAutomation.postMessage('ACK'); | 14 portToAutomation.postMessage('ACK'); |
| 15 }); | 15 }); |
| 16 | 16 |
| 17 // Window events. | 17 // Window events. |
| 18 chrome.windows.onCreated.addListener(function(windowId) { | 18 chrome.windows.onCreated.addListener(function(createInfo) { |
| 19 portToAutomation.postMessage(chrome.windows.onCreated.eventName_); | 19 portToAutomation.postMessage(chrome.windows.onCreated.eventName_); |
| 20 }); | 20 }); |
| 21 chrome.windows.onRemoved.addListener(function(windowId) { | 21 chrome.windows.onRemoved.addListener(function(windowId) { |
| 22 portToAutomation.postMessage(chrome.windows.onRemoved.eventName_); | 22 portToAutomation.postMessage(chrome.windows.onRemoved.eventName_); |
| 23 }); | 23 }); |
| 24 chrome.windows.onFocusChanged.addListener(function(windowId) { | 24 chrome.windows.onFocusChanged.addListener(function(windowId) { |
| 25 portToAutomation.postMessage(chrome.windows.onFocusChanged.eventName_); | 25 portToAutomation.postMessage(chrome.windows.onFocusChanged.eventName_); |
| 26 }); | 26 }); |
| 27 | 27 |
| 28 // Tab events. | 28 // Tab events. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 42 portToAutomation.postMessage(chrome.tabs.onAttached.eventName_); | 42 portToAutomation.postMessage(chrome.tabs.onAttached.eventName_); |
| 43 }); | 43 }); |
| 44 chrome.tabs.onDetached.addListener(function(tabId, info) { | 44 chrome.tabs.onDetached.addListener(function(tabId, info) { |
| 45 portToAutomation.postMessage(chrome.tabs.onDetached.eventName_); | 45 portToAutomation.postMessage(chrome.tabs.onDetached.eventName_); |
| 46 }); | 46 }); |
| 47 chrome.tabs.onRemoved.addListener(function(tabId) { | 47 chrome.tabs.onRemoved.addListener(function(tabId) { |
| 48 portToAutomation.postMessage(chrome.tabs.onRemoved.eventName_); | 48 portToAutomation.postMessage(chrome.tabs.onRemoved.eventName_); |
| 49 }); | 49 }); |
| 50 | 50 |
| 51 // Bookmark events. | 51 // Bookmark events. |
| 52 chrome.bookmarks.onAdded.addListener(function(info) { | 52 chrome.bookmarks.onCreated.addListener(function(info) { |
| 53 portToAutomation.postMessage(chrome.bookmarks.onAdded.eventName_); | 53 portToAutomation.postMessage(chrome.bookmarks.onCreated.eventName_); |
| 54 }); | 54 }); |
| 55 chrome.bookmarks.onRemoved.addListener(function(info) { | 55 chrome.bookmarks.onRemoved.addListener(function(info) { |
| 56 portToAutomation.postMessage(chrome.bookmarks.onRemoved.eventName_); | 56 portToAutomation.postMessage(chrome.bookmarks.onRemoved.eventName_); |
| 57 }); | 57 }); |
| 58 chrome.bookmarks.onChanged.addListener(function(bookmarkId, info) { | 58 chrome.bookmarks.onChanged.addListener(function(bookmarkId, info) { |
| 59 portToAutomation.postMessage(chrome.bookmarks.onChanged.eventName_); | 59 portToAutomation.postMessage(chrome.bookmarks.onChanged.eventName_); |
| 60 }); | 60 }); |
| 61 chrome.bookmarks.onMoved.addListener(function(info) { | 61 chrome.bookmarks.onMoved.addListener(function(info) { |
| 62 portToAutomation.postMessage(chrome.bookmarks.onMoved.eventName_); | 62 portToAutomation.postMessage(chrome.bookmarks.onMoved.eventName_); |
| 63 }); | 63 }); |
| 64 chrome.bookmarks.onChildrenReordered.addListener(function(bookmarkId, | 64 chrome.bookmarks.onChildrenReordered.addListener(function(bookmarkId, |
| 65 children) { | 65 reorderInfo) { |
| 66 portToAutomation.postMessage( | 66 portToAutomation.postMessage( |
| 67 chrome.bookmarks.onChildrenReordered.eventName_); | 67 chrome.bookmarks.onChildrenReordered.eventName_); |
| 68 }); | 68 }); |
| 69 | 69 |
| 70 // Call chrome window api. The result of this api is not important, as this | 70 // Call chrome window api. The result of this api is not important, as this |
| 71 // is used only to let the automation test driver know that this page is | 71 // is used only to let the automation test driver know that this page is |
| 72 // loaded and ready to receive events. | 72 // loaded and ready to receive events. |
| 73 chrome.windows.getCurrent(function() {}); | 73 chrome.windows.getCurrent(function() {}); |
| 74 document.write('DONE'); | 74 document.write('DONE'); |
| 75 </script> | 75 </script> |
| OLD | NEW |