1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 var validate = function(policy) {
6 // This is the policy set by component_cloud_policy_browsertest.cc.
7 if (JSON.stringify(policy) == '{"Another":"turn_it_off"}')
8 chrome.test.sendMessage('ok');
10 chrome.test.sendMessage('fail');
13 // Get the initial policy, in case it was fetched before the extension started.
14 chrome.storage.managed.get(function(policy) {
15 if (JSON.stringify(policy) == '{}') {
16 // Start listening for the update event.
17 chrome.storage.onChanged.addListener(function(changes, namespace) {
18 if (namespace == 'managed') {
19 // Get all the policies and validate them.
20 chrome.storage.managed.get(validate);