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
3 // found in the LICENSE file.
5 var cwsContainerMock = {};
7 // This ID will be checked in the test.
8 var DUMMY_ITEM_ID = 'DUMMY_ITEM_ID_FOR_TEST';
14 cwsContainerMock.onMessage = function (message) {
16 source = message.source;
17 origin = message.origin;
19 switch (data['message']) {
21 cwsContainerMock.onInitialize(source);
26 cwsContainerMock.onInitialize = function() {
28 source.postMessage({message: 'widget_loaded'}, origin);
31 cwsContainerMock.onInstallButton = function() {
32 if (source && origin) {
34 {message: 'before_install', item_id:DUMMY_ITEM_ID}, origin);
40 function onInstallButton() {
41 cwsContainerMock.onInstallButton();
44 window.addEventListener('message', cwsContainerMock.onMessage);