OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var embedder = {}; | 5 var embedder = {}; |
6 embedder.test = {}; | 6 embedder.test = {}; |
7 embedder.baseGuestURL = ''; | 7 embedder.baseGuestURL = ''; |
8 embedder.guestURL = ''; | 8 embedder.guestURL = ''; |
9 | 9 |
10 window.runTest = function(testName) { | 10 window.runTest = function(testName) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 }; | 106 }; |
107 window.addEventListener('message', onPostMessageReceived); | 107 window.addEventListener('message', onPostMessageReceived); |
108 }; | 108 }; |
109 | 109 |
110 /** @private */ | 110 /** @private */ |
111 embedder.assertCorrectEvent_ = function(e) { | 111 embedder.assertCorrectEvent_ = function(e) { |
112 embedder.test.assertEq('geolocation', e.permission); | 112 embedder.test.assertEq('geolocation', e.permission); |
113 embedder.test.assertTrue(!!e.url); | 113 embedder.test.assertTrue(!!e.url); |
114 embedder.test.assertTrue(e.url.indexOf(embedder.baseGuestURL) == 0); | 114 embedder.test.assertTrue(e.url.indexOf(embedder.baseGuestURL) == 0); |
115 | |
116 // Check that unexpected properties (from other permissionrequest) do not show | |
117 // up in the event object. | |
118 embedder.test.assertFalse('userGesture' in e); | |
119 }; | 115 }; |
120 | 116 |
121 // Tests begin. | 117 // Tests begin. |
122 | 118 |
123 // Once the guest is allowed or denied geolocation, the guest notifies the | 119 // Once the guest is allowed or denied geolocation, the guest notifies the |
124 // embedder about the fact via post message. | 120 // embedder about the fact via post message. |
125 // The embedder has to initiate a post message so that the guest can get a | 121 // The embedder has to initiate a post message so that the guest can get a |
126 // reference to embedder to send the reply back. | 122 // reference to embedder to send the reply back. |
127 // | 123 // |
128 // We have to run each test (from embedder.test.testList) in a separate platform | 124 // We have to run each test (from embedder.test.testList) in a separate platform |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 'testDeny': testDeny, | 186 'testDeny': testDeny, |
191 'testMultipleBridgeIdAllow': testMultipleBridgeIdAllow | 187 'testMultipleBridgeIdAllow': testMultipleBridgeIdAllow |
192 }; | 188 }; |
193 | 189 |
194 onload = function() { | 190 onload = function() { |
195 chrome.test.getConfig(function(config) { | 191 chrome.test.getConfig(function(config) { |
196 embedder.setUp_(config); | 192 embedder.setUp_(config); |
197 chrome.test.sendMessage('Launched'); | 193 chrome.test.sendMessage('Launched'); |
198 }); | 194 }); |
199 }; | 195 }; |
OLD | NEW |