Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: chrome/test/data/chromeos/file_manager/cws_container_mock/main.js

Issue 1061133005: Wait for 'after_install' from widget before closing SuggestAppsDialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@break_up_suggest_apps_dialog
Patch Set: rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/file_manager/file_manager/foreground/js/app_installer.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 cwsContainerMock = {}; 5 var cwsContainerMock = {};
6 (function() { 6 (function() {
7 // This ID will be checked in the test. 7 // This ID will be checked in the test.
8 var DUMMY_ITEM_ID = 'DUMMY_ITEM_ID_FOR_TEST'; 8 var DUMMY_ITEM_ID = 'DUMMY_ITEM_ID_FOR_TEST';
9 9
10 var origin = null; 10 var origin = null;
11 var data = null; 11 var data = null;
12 var source = null; 12 var source = null;
13 13
14 cwsContainerMock.onMessage = function (message) { 14 cwsContainerMock.onMessage = function (message) {
15 data = message.data; 15 data = message.data;
16 source = message.source; 16 source = message.source;
17 origin = message.origin; 17 origin = message.origin;
18 18
19 switch (data['message']) { 19 switch (data['message']) {
20 case 'initialize': 20 case 'initialize':
21 cwsContainerMock.onInitialize(source); 21 cwsContainerMock.onInitialize();
22 break;
23 case 'install_success':
24 cwsContainerMock.onInstallSuccess();
22 break; 25 break;
23 }; 26 };
24 } 27 }
25 28
26 cwsContainerMock.onInitialize = function() { 29 cwsContainerMock.onInitialize = function() {
27 if (source && origin) 30 if (source && origin)
28 source.postMessage({message: 'widget_loaded'}, origin); 31 source.postMessage({message: 'widget_loaded'}, origin);
29 }; 32 };
30 33
34 cwsContainerMock.onInstallSuccess = function() {
35 if (source && origin)
36 source.postMessage({
37 message: 'after_install',
38 item_id: DUMMY_ITEM_ID
39 }, origin);
40 };
41
31 cwsContainerMock.onInstallButton = function() { 42 cwsContainerMock.onInstallButton = function() {
32 if (source && origin) { 43 if (source && origin) {
33 source.postMessage( 44 source.postMessage(
34 {message: 'before_install', item_id:DUMMY_ITEM_ID}, origin); 45 {message: 'before_install', item_id:DUMMY_ITEM_ID}, origin);
35 } 46 }
36 }; 47 };
37 48
38 })(); 49 })();
39 50
40 function onInstallButton() { 51 function onInstallButton() {
41 cwsContainerMock.onInstallButton(); 52 cwsContainerMock.onInstallButton();
42 }; 53 };
43 54
44 window.addEventListener('message', cwsContainerMock.onMessage); 55 window.addEventListener('message', cwsContainerMock.onMessage);
OLDNEW
« no previous file with comments | « no previous file | ui/file_manager/file_manager/foreground/js/app_installer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698