Commit 1076d92a authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Do not open browser when testing sign-in extensions

SigninExtensionsDeviceCloudPolicyBrowserTests were opening a browser
window in Sign-in profile and running the test code in that context.
In general, browser windows should not be used in sign-in profile,
so we should not rely on this behavior in tests.

The test code is moved to the test extensions background page, and
run on runtime.onInstalled event (which should be dispatched on each
extension install event - note that running the tests in event listener
is not strictly necessary, but it gives better indication of the
reason the background page is loaded).

Given that in sign-in profile, background hosts are not allowed for
non-policy installed extensions, the test is updated to set up policy
to force install the test extension (which is packed into a CRX,
which is added to test data dir). Furthermore, the test extension is
transformed to an app, and whitelisted using whitelisted-extension-id
switch. This makes ScopedSigninScreenPolicyProviderDisabler
unnecessary.

PreinstalledSigninExtensionsDeviceCloudPolicyBrowserTest is dropped,
and the component policy caching is tested by running sign-in
extension device policy tests in two parts:
 * first, PRE_ManagedStorage test downloads the component policy from
   the tests server and runs the test extension (matches the logic in
   replaced InstallAndRunInWindow test)
 * the second, ManagedStorage test verifies that the downloaded policy
   is cached and usable after restart by throttling the component
   policy download request.

BUG=916859

Change-Id: Ia0748c2914649ea439664d748aca0bd5461a397f
Reviewed-on: https://chromium-review.googlesource.com/c/1379702Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619545}
parent 71e2c3fd
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDOhNQJlm3y7CGX
9Qf3P3KgHHJMzPlZKOR9wlfm1gk9l7pIaBVQN6cWqH8DcTY+FEiaXAOmx6rO4S1p
Nkt9Mong/c18g8CuKpJ122Acz8u/4yojHgqCsV0R5wC6q3aXjbtB7A7NkI3W8wvP
XB2/4GQwcwQI72a6f4y6hfnkZ5A+HC4RqnOIoJLXKWZj3WZOkFstI1V5p5cLoSZu
E1mn7NvX4QeY8nUxoKf1Bdlps4/RrLRuS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MJvq4rtJJb+h30GxXFvRQc0l74AXRSzjSeIvDAo5M1Mw7lmMhOBYG9Iapj
rY+8VCcfmHYAV8TMj2pGVQcjbgphbx74F2fDEQfNAoGBAOB5uPCqi4qq243Nshaq
CFC4Og55G1EI9asYwhLgIHAz+0dED+CX457N/MKHI4F2SAV9TBCRPGobJW2S4E/7
jfkGxTiebBxaXwyJbvdDhA4KnLnwrkXjutC/IJ2Qq1A6m2xH2rRWWLyOFD6G/PAz
qnBj2AbiXMZuT+G8otTGn1yR
-----END PRIVATE KEY-----
{
"name": "signin screen managed storage tests",
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyX1I7kDgMFRsOGGQGZSSRWy8N/IlSsvWbzOgkQH0eaO/OxgDPD/CQTfeaYkFNO9o7/Nuz2qnMKugE9WpCNuJgnbUlMcY3Fe+QCa8NF8Gu1D/kvS209s0sTBDKj8Ydy4i4OVmKLGhE3zXu2RImr2utamOCJAgUXzCC+OiXVn8u73akPAlgsElvL3vgfBKAOfb4ub1HaxgAFo6FbIoleq0T7sM3k5tRn/RY5tu93YFMoP07o7vzEGri6bpPCf42pUVH3bnQ3Q2Lab2WfNyYstqKFJQ+EGPnsc3WtCL5N4PjaJ31o3bKWA/u8r8rO2PsVhTkNbCzC/p+/gD/APDof4ZwIDAQAB",
"version": "1.0",
"manifest_version": 2,
"description": "Tests that the managed Storage API works on the signin screen.",
"app": {
"background": {
"scripts": ["test.js"]
}
},
"storage": {
"managed_schema": "schema.json"
}
......
......@@ -2,13 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
chrome.test.runTests([
function getPolicy() {
chrome.runtime.onInstalled.addListener(function() {
chrome.test.runTests([function getPolicy() {
chrome.storage.managed.get(
'string-policy',
chrome.test.callbackPass(function(results) {
chrome.test.assertEq({
'string-policy': 'value'
}, results);
'string-policy', chrome.test.callbackPass(function(results) {
chrome.test.assertEq({'string-policy': 'value'}, results);
}));
}]);
});
<!--
* Copyright 2016 The Chromium Authors. All rights reserved. Use of this
* source code is governed by a BSD-style license that can be found in the
* LICENSE file.
-->
<script src="test.js"></script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment