├── .gitignore ├── docs └── images │ ├── home-screen.png │ ├── developer-mode.png │ ├── pick-manifest.png │ ├── load-unpacked-extension.png │ ├── successfull-installation.png │ └── installed-extensions-settings.png ├── api-test-extension ├── icons │ ├── icon16.png │ ├── icon19.png │ ├── icon48.png │ ├── icon80.png │ └── icon128.png ├── src │ ├── browser_action │ │ ├── popup.html │ │ ├── bg.js │ │ ├── run_test.js │ │ ├── browser_action.html │ │ └── browser_action.js │ ├── tests │ │ ├── tabs_bg.js │ │ ├── content_scripts_bg.js │ │ ├── web_navigation.js │ │ ├── content_scripts.js │ │ ├── top_sites.js │ │ ├── storage.js │ │ ├── browser_action.js │ │ ├── popup_scripts.js │ │ ├── notifications.js │ │ ├── alarms.js │ │ ├── idle.js │ │ ├── common.js │ │ ├── history.js │ │ ├── browsing_data.js │ │ ├── windows.js │ │ ├── context_menus.js │ │ ├── web_request.js │ │ ├── sessions.js │ │ ├── cookies.js │ │ ├── downloads.js │ │ ├── bookmarks.js │ │ ├── extension.js │ │ ├── privacy.js │ │ ├── content_settings.js │ │ └── tabs.js │ └── APITest │ │ └── test.js ├── manifest.json └── css │ └── styles.css └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | *.DS_Store -------------------------------------------------------------------------------- /docs/images/home-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex/browser-extensions/master/docs/images/home-screen.png -------------------------------------------------------------------------------- /docs/images/developer-mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex/browser-extensions/master/docs/images/developer-mode.png -------------------------------------------------------------------------------- /docs/images/pick-manifest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex/browser-extensions/master/docs/images/pick-manifest.png -------------------------------------------------------------------------------- /api-test-extension/icons/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex/browser-extensions/master/api-test-extension/icons/icon16.png -------------------------------------------------------------------------------- /api-test-extension/icons/icon19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex/browser-extensions/master/api-test-extension/icons/icon19.png -------------------------------------------------------------------------------- /api-test-extension/icons/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex/browser-extensions/master/api-test-extension/icons/icon48.png -------------------------------------------------------------------------------- /api-test-extension/icons/icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex/browser-extensions/master/api-test-extension/icons/icon80.png -------------------------------------------------------------------------------- /api-test-extension/icons/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex/browser-extensions/master/api-test-extension/icons/icon128.png -------------------------------------------------------------------------------- /docs/images/load-unpacked-extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex/browser-extensions/master/docs/images/load-unpacked-extension.png -------------------------------------------------------------------------------- /docs/images/successfull-installation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex/browser-extensions/master/docs/images/successfull-installation.png -------------------------------------------------------------------------------- /docs/images/installed-extensions-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex/browser-extensions/master/docs/images/installed-extensions-settings.png -------------------------------------------------------------------------------- /api-test-extension/src/browser_action/popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
39 |
40 | ### 3. Turn on the Developer Mode by checking the box
41 |
42 |
43 | ### 4. Tap "Load unpacked extension"
44 |
45 |
46 | ### 5. Find your extension folder and pick manifest.json
47 |
48 |
49 |
50 | ## Install From Store
51 |
52 | 1) Using the "Settings -> Extensions -> Opera Store" or "Settings -> Extensions -> Google Chrome Webstore" menu open the store page
53 |
54 | 2) Find the extension and add them to browser
55 |
--------------------------------------------------------------------------------
/api-test-extension/src/tests/popup_scripts.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var popup_scripts = new TestSet()
4 | .require('[empty]', () => '', { hideOnSuccess: true })
5 | .manual('popup-scripts-test', "Click on extension button again")
6 | .report_ready(() => {
7 | const TEST_NAME = 'popup-scripts-test';
8 |
9 | let tabsMsgFromPopup = { data: 'tabs_msg_from_popup' }; // Incoming
10 | let msgToPopup = { data: 'msg_from_tab' }; // Outgoing
11 | let runtimeMsgFromPopup = { data: 'runtime_msg_from_popup' }; // Incoming
12 | let runtimeMsgFromBackground = { data: 'runtime_msg_from_background'}; // Incoming
13 |
14 | // Here tab message is chrome.tabs.sendMessage() and
15 | // runtime message is chrome.tabs.sendMessage() :
16 |
17 | // 1. Activated popup sends initial tab message to tab.
18 | // 2. Tab receives initial message and sends broadcast runtime message and popup should receive it.
19 | // 3. Then popup sends broadcast runtime message to tab and awaits for callback.
20 | // 4. Background also receives broadcast message from popup.
21 | // 5. Then background sends broadcast runtime message to tab.
22 | // 6. If tab received msg from background the test is done.
23 |
24 | let listener = function (response, sender, sendResponse) {
25 | if (response.data == tabsMsgFromPopup.data) {
26 | sendResponse('Tab');
27 | chrome.runtime.sendMessage(msgToPopup, response => {
28 | if (response != 'Popup') {
29 | failManualTest(
30 | TEST_NAME,
31 | "Message received by the tab from the popup differs from expected"
32 | )
33 | }
34 | });
35 | } else if (response.data == runtimeMsgFromPopup.data) {
36 | sendResponse('Tab');
37 | } else if (response.data == runtimeMsgFromBackground.data) {
38 | sendResponse('Tab');
39 | doneManualTest('popup-scripts-test');
40 | chrome.runtime.onMessage.removeListener(listener);
41 | }
42 | };
43 |
44 | chrome.runtime.onMessage.addListener(listener);
45 | });
46 |
--------------------------------------------------------------------------------
/api-test-extension/src/tests/notifications.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var notifications_test = new TestSet()
4 | .require("[Method Exists] notifications", methodExists(chrome, 'notifications'), { hideOnSuccess: true })
5 |
6 | .require("[Method Exists] create", methodExists(chrome.notifications, 'create'), { hideOnSuccess: true })
7 | .require("[Method Call] create", methodCall(chrome.notifications, 'create', {
8 | type: 'basic',
9 | title: "",
10 | iconUrl: "",
11 | message: ""
12 | }, () => {}))
13 |
14 | .require("[Method Exists] update", methodExists(chrome.notifications, 'update'), { hideOnSuccess: true })
15 | .require("[Method Call] update", methodCall(chrome.notifications, 'update', "", {}, () => {}))
16 |
17 | .require("[Method Exists] clear", methodExists(chrome.notifications, 'clear'), { hideOnSuccess: true })
18 | .require("[Method Call] clear", methodCall(chrome.notifications, 'clear', "", () => {}))
19 |
20 | .require("[Method Exists] ", methodExists(chrome.notifications, 'getAll'), { hideOnSuccess: true })
21 | .require("[Method Call] ", methodCall(chrome.notifications, 'getAll', () => {}))
22 |
23 | .require("[Method Exists] ", methodExists(chrome.notifications, 'getPermissionLevel'), { hideOnSuccess: true })
24 | .require("[Method Call] ", methodCall(chrome.notifications, 'getPermissionLevel', () => {}))
25 |
26 | .manual('notification-test', "[Test Notification] Press Start and then click on appeared notification" +
27 | " ")
28 | .report_ready(() => {
29 | $('#notification-test-button').click(() => {
30 | chrome.notifications.create({
31 | type: 'basic',
32 | iconUrl: "/icons/icon80.png",
33 | title: "Test",
34 | message: "Test"
35 | }, id => {
36 | let listener = function (id_) {
37 | if (id == id_) {
38 | doneManualTest('notification-test');
39 | chrome.notifications.onClicked.removeListener(listener);
40 | }
41 | };
42 |
43 | chrome.notifications.onClicked.addListener(listener);
44 | });
45 | })
46 | });
47 |
--------------------------------------------------------------------------------
/api-test-extension/src/tests/alarms.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var alarms_test = new TestSet()
4 | .require("[Method Exists]", methodExists(chrome, "alarms"), { hideOnSuccess: true })
5 |
6 | .require("[Method Exists] create", methodExists(chrome.alarms, 'create'), { hideOnSuccess: true })
7 | .require("[Method Call] create", methodCall(chrome.alarms, 'create', "", {}))
8 |
9 | .require("[Method Exists] get", methodExists(chrome.alarms, 'get'), { hideOnSuccess: true })
10 | .require("[Method Call] get", methodCall(chrome.alarms, 'get', "", () => {}))
11 |
12 | .require("[Method Exists] getAll", methodExists(chrome.alarms, 'getAll'), { hideOnSuccess: true })
13 | .require("[Method Call] getAll", methodCall(chrome.alarms, 'getAll', () => {}))
14 |
15 | .require("[Method Exists] clear", methodExists(chrome.alarms, 'clear'), { hideOnSuccess: true })
16 | .require("[Method Call] clear", methodCall(chrome.alarms, 'clear'))
17 |
18 | .require("[Method Exists] clearAll", methodExists(chrome.alarms, 'clearAll'), { hideOnSuccess: true })
19 | .require("[Method Call] clearAll", methodCall(chrome.alarms, 'clearAll'))
20 |
21 | .manual('check-alarm-delay', "[Create Alarm and Delayed Fire] click on Start button to create alarm," +
22 | " test usually passes during 1 minute (but can be delayed)" +
23 | " ")
24 |
25 | .manual('check-alarm-period', "[Periodic Fire] usually passes " +
26 | "during 1 minute after Delayed Fire test is done")
27 |
28 | .report_ready(() => {
29 | $('#check-alarm-button').click(() => {
30 | chrome.alarms.create("APITestAlarm", {
31 | delayInMinutes: 1,
32 | periodInMinutes: 1
33 | });
34 |
35 | let listener = function (alarm) {
36 | if (alarm.name == "APITestAlarm") {
37 | if ($('#check-alarm-delay').data('status') != "done") {
38 | doneManualTest('check-alarm-delay');
39 | } else {
40 | doneManualTest('check-alarm-period');
41 | chrome.alarms.onAlarm.removeListener(listener);
42 | chrome.alarms.clear("APITestAlarm")
43 | }
44 | }
45 | };
46 |
47 | chrome.alarms.onAlarm.addListener(listener);
48 | })
49 | });
50 |
--------------------------------------------------------------------------------
/api-test-extension/css/styles.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #f2f2f2;
3 | font-family: Arial, Helvetica, sans-serif;
4 | font-size: 12px;
5 | }
6 |
7 | .title {
8 | padding: 0 10px 0 10px;
9 | margin-bottom: 20px;
10 | }
11 |
12 | .report-container {
13 | width: 100%;
14 | }
15 |
16 | .test-set-container {
17 | padding: 0 10px 0 10px;
18 | margin-bottom: 30px;
19 | }
20 |
21 | .auto-test-set-title {
22 | min-height: 40px;
23 | min-width: 240px;
24 | padding-left: 10px;
25 | line-height: 40px;
26 | font-size: 1.6em;
27 | border: #808080 2px solid;
28 | }
29 |
30 | .manual-test-set-title {
31 | min-height: 40px;
32 | line-height: 40px;
33 | font-size: 1.6em;
34 | min-width: 240px;
35 | padding-left: 10px;
36 | margin-top: -2px;
37 | border: gray 2px solid;
38 | background-color: #337ab7;
39 | }
40 |
41 | .auto-tests-list {
42 | border: gray 2px solid;
43 | border-bottom-width: 1px;
44 | margin-top: -2px;
45 | }
46 |
47 | .manual-tests-list {
48 | border: gray 2px solid;
49 | border-bottom-width: 1px;
50 | margin-top: -2px
51 | }
52 |
53 | .auto-test-item {
54 | padding-left: 10px;
55 | min-height: 32px;
56 | line-height: 32px;
57 | font-size: 1.4em;
58 | }
59 |
60 | .manual-test-item {
61 | padding-left: 10px;
62 | min-height: 32px;
63 | line-height: 32px;
64 | font-size: 1.4em;
65 | background-color: #d9edf7;
66 | color: #333;
67 | }
68 |
69 | .line {
70 | height: 1px;
71 | background-color: gray
72 | }
73 |
74 | .button-red, #history-delete-all-button {
75 | font-size: 1em;
76 | background-color: #c52222;
77 | color: white;
78 | border: 1px grey solid;
79 | cursor: pointer;
80 | }
81 |
82 | .button-blue, #check-idle-button, #check-lock-button {
83 | font-size: 1em;
84 | background-color: #2323c4;
85 | color: white;
86 | border: 1px grey solid;
87 | cursor: pointer;
88 | }
89 |
90 | .button-green {
91 | font-size: 1em;
92 | background-color: #23c223;
93 | color: white;
94 | border: 1px #006400 solid;
95 | cursor: pointer;
96 | }
97 |
98 | .title-container {
99 | display: inline-block;
100 | width: 180px;
101 | margin-right: 10px;
102 | }
103 |
104 | .save-report-container {
105 | display: inline-block;
106 | float: right;
107 | margin: 0.7em 0 0 0;
108 | font-size: 1.4em;
109 | }
110 |
--------------------------------------------------------------------------------
/api-test-extension/src/tests/idle.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var idle_test = new TestSet()
4 | .require("[Method Exists] idle", methodExists(chrome, 'idle'), { hideOnSuccess: true })
5 |
6 | .require("[Method Exists] queryState", methodExists(chrome.idle, 'queryState'), { hideOnSuccess: true })
7 | .require("[Method Call] queryState", methodCall(chrome.idle, 'queryState', 60, () => {}))
8 |
9 | .require("[Method Exists] setDetectionInterval", methodExists(chrome.idle, 'setDetectionInterval'),
10 | { hideOnSuccess: true })
11 | .require("[Method Call] setDetectionInterval", methodCall(chrome.idle, 'setDetectionInterval', 60))
12 |
13 | .require("[Check active state]", () => {
14 | return new Promise((resolve, reject) => {
15 | chrome.idle.queryState(10000, state => {
16 | if (state == 'active') {
17 | resolve('');
18 | } else {
19 | reject("Expected state is active, actual state: " + state);
20 | }
21 | })
22 | })
23 | }, { async: true })
24 |
25 | .manual('check-idle', "[Check idle state] click on Start button, stay still until end of the test (approx. 15sec)" +
26 | " ")
27 | .manual('check-lock', "[Check lock state] click on Start button, lock your device, return after 20sec" +
28 | " ")
29 |
30 | .report_ready(() => {
31 | $('#check-idle-button').click(() => {
32 | let min_allowed_time_in_seconds = 15;
33 | setTimeout(() => {
34 | chrome.idle.queryState(min_allowed_time_in_seconds, state => {
35 | if (state == 'idle') {
36 | doneManualTest('check-idle');
37 | } else {
38 | failManualTest('check-idle', "Expected state: idle, actual state: " + state);
39 | }
40 | });
41 | }, (min_allowed_time_in_seconds + 2) * 1000);
42 | });
43 |
44 | $('#check-lock-button').click(() => {
45 | let test_time_in_seconds = 20;
46 | setTimeout(() => {
47 | chrome.idle.queryState(10000, state => {
48 | if (state == 'locked') {
49 | doneManualTest('check-lock');
50 | } else {
51 | failManualTest('check-lock', "Expected state: locked, actual state: " + state);
52 | }
53 | });
54 | }, test_time_in_seconds * 1000);
55 | });
56 | });
--------------------------------------------------------------------------------
/api-test-extension/src/browser_action/browser_action.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |