| OLD | NEW |
| 1 This directory contains tests for chrome extension activity logging. | 1 This directory contains tests for chrome extension activity logging. |
| 2 | 2 |
| 3 The tests use two chrome extensions: | 3 The tests use two chrome extensions: |
| 4 -test : sends messages to the friend extension and listens for activity | 4 -test : sends messages to the friend extension and listens for activity |
| 5 logged by the friend extension. Checks the activity has been logged | 5 logged by the friend extension. Checks the activity has been logged |
| 6 correctly. | 6 correctly. |
| 7 -friend: recieves messages from the extension and runs a function based on | 7 -friend: recieves messages from the extension and runs a function based on |
| 8 the contents of the message. | 8 the contents of the message. |
| 9 | 9 |
| 10 | 10 |
| 11 Adding a new test: | 11 Adding a new test: |
| 12 | 12 |
| 13 In friend/reply.js: | 13 In friend/reply.js: |
| 14 (1) Add a function to call the chrome api calls you want to test. | 14 (1) Add a function to call the chrome api calls you want to test. If you |
| 15 NOTE: The function should clean up any changes it made (e.g. listeners | 15 need to use window.open please consider adding your code to |
| 16 executeApiCallsOnTabUpdated or executeDOMChangesOnTabUpdated. Every |
| 17 extra window.open call will slow down the tests by 3s and may cause |
| 18 timeouts. |
| 19 (2) Add the name of the new function to the function map (fnMap). |
| 20 |
| 21 IMPORTANT NOTES for adding tests: |
| 22 - The function should clean up any changes it made (e.g. listeners |
| 16 it added) before finishing. If they are not cleaned up then unexpected | 23 it added) before finishing. If they are not cleaned up then unexpected |
| 17 behavior can happen in test cases that run after this function. | 24 behavior can happen in test cases that run after this function. |
| 18 (2) Add the name of the new function to the function map (fnMap). | 25 - Every window.open call can add 3 secs to the test run for debug builds. |
| 26 Making lots of window.open calls will therefore cause the tests to |
| 27 timeout. If your test needs to use window.open please consider adding |
| 28 it to one of the following existing functions: |
| 29 - executeApiCallsOnTabUpdated |
| 30 - executeDOMChangesOnTabUpdated |
| 19 | 31 |
| 20 In friend/options.html: | 32 In friend/options.html: |
| 21 (1) Add a button to allow the new function to be called in manual mode. | 33 (1) Add a button to allow the new function to be called in manual mode. |
| 22 | 34 |
| 23 You may need also to modify the manifest.json and other files in the | 35 You may need also to modify the manifest.json and other files in the |
| 24 friend extension directory. | 36 friend extension directory. |
| 25 | 37 |
| 26 In test/test.js: | 38 In test/test.js: |
| 27 (1) Add the test to the testcase array. | 39 (1) Add the test to the testcase array. |
| 28 | 40 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 47 > out/Debug/browser_tests --gtest_filter=ActivityLogApiTest.TriggerEvent | 59 > out/Debug/browser_tests --gtest_filter=ActivityLogApiTest.TriggerEvent |
| 48 | 60 |
| 49 | 61 |
| 50 Running in manual mode: | 62 Running in manual mode: |
| 51 | 63 |
| 52 (1) Start chrome with out/Debug/chrome | 64 (1) Start chrome with out/Debug/chrome |
| 53 (2) Navigate to chrome://extensions | 65 (2) Navigate to chrome://extensions |
| 54 (3) Install the friend and test extensions from your chrome src folder | 66 (3) Install the friend and test extensions from your chrome src folder |
| 55 (4) Click on the "options" link under the friend extension | 67 (4) Click on the "options" link under the friend extension |
| 56 (5) You should see the options page the buttons to run the functions manually | 68 (5) You should see the options page the buttons to run the functions manually |
| OLD | NEW |