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

Side by Side Diff: chrome/test/data/webui/plugins_browsertest.js

Issue 2571903003: Mojo JS bindings: switch most usage of "connection"/"router" module to "bindings". (Closed)
Patch Set: Merge branch 'refs/heads/c161_more_bindings_change' into c160_remove_connection_mojo Created 4 years 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** 5 /**
6 * @fileoverview Tests for chrome://plugins 6 * @fileoverview Tests for chrome://plugins
7 */ 7 */
8 8
9 /** @const {string} Path to source root. */ 9 /** @const {string} Path to source root. */
10 var ROOT_PATH = '../../../../'; 10 var ROOT_PATH = '../../../../';
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 * @constructor 48 * @constructor
49 * @extends {TestBrowserProxyBase} 49 * @extends {TestBrowserProxyBase}
50 */ 50 */
51 var TestBrowserProxy = function() { 51 var TestBrowserProxy = function() {
52 settings.TestBrowserProxy.call(this, [ 52 settings.TestBrowserProxy.call(this, [
53 'getPluginsData', 53 'getPluginsData',
54 'getShowDetails', 54 'getShowDetails',
55 'saveShowDetailsToPrefs', 55 'saveShowDetailsToPrefs',
56 ]); 56 ]);
57 57
58 this.bindingSet = null;
59
58 /** 60 /**
59 * The data to be returned by |getPluginsData_|. 61 * The data to be returned by |getPluginsData_|.
60 * @private 62 * @private
61 */ 63 */
62 this.pluginsData_ = []; 64 this.pluginsData_ = [];
63 }; 65 };
64 66
65 TestBrowserProxy.prototype = { 67 TestBrowserProxy.prototype = {
66 __proto__: settings.TestBrowserProxy.prototype, 68 __proto__: settings.TestBrowserProxy.prototype,
67 69
(...skipping 21 matching lines...) Expand all
89 }; 91 };
90 92
91 this.browserProxy = new TestBrowserProxy(); 93 this.browserProxy = new TestBrowserProxy();
92 94
93 // A function that is called from chrome://plugins to allow this test to 95 // A function that is called from chrome://plugins to allow this test to
94 // replace the real Mojo browser proxy with a fake one, before any other 96 // replace the real Mojo browser proxy with a fake one, before any other
95 // code runs. 97 // code runs.
96 window.setupFn = function() { 98 window.setupFn = function() {
97 return importModules([ 99 return importModules([
98 'mojo/public/js/bindings', 100 'mojo/public/js/bindings',
99 'mojo/public/js/connection',
100 'chrome/browser/ui/webui/plugins/plugins.mojom', 101 'chrome/browser/ui/webui/plugins/plugins.mojom',
101 'content/public/renderer/frame_interfaces', 102 'content/public/renderer/frame_interfaces',
102 ]).then(function(modules) { 103 ]).then(function(modules) {
103 var bindings = modules[0]; 104 var bindings = modules[0];
104 var connection = modules[1]; 105 var pluginsMojom = modules[1];
105 var pluginsMojom = modules[2]; 106 var frameInterfaces = modules[2];
106 var frameInterfaces = modules[3];
107 107
108 this.browserProxy.bindingSet = new bindings.BindingSet(
109 pluginsMojom.PluginsPageHandler);
108 frameInterfaces.addInterfaceOverrideForTesting( 110 frameInterfaces.addInterfaceOverrideForTesting(
109 pluginsMojom.PluginsPageHandler.name, function(handle) { 111 pluginsMojom.PluginsPageHandler.name, function(handle) {
110 var stub = connection.bindHandleToStub( 112 this.browserProxy.bindingSet(this.browserProxy, handle);
Ken Rockot(use gerrit already) 2016/12/16 16:43:19 nit: addBinding :)
yzshen1 2016/12/16 16:55:08 It scares me a little bit that this doesn't fail t
111 handle, pluginsMojom.PluginsPageHandler);
112 bindings.StubBindings(stub).delegate = this.browserProxy;
113 }.bind(this)); 113 }.bind(this));
114 return this.setupFnResolver.promise; 114 return this.setupFnResolver.promise;
115 }.bind(this)); 115 }.bind(this));
116 }.bind(this); 116 }.bind(this);
117 }, 117 },
118 }; 118 };
119 119
120 TEST_F('PluginsTest', 'Plugins', function() { 120 TEST_F('PluginsTest', 'Plugins', function() {
121 var browserProxy = this.browserProxy; 121 var browserProxy = this.browserProxy;
122 var setupFnResolver = this.setupFnResolver; 122 var setupFnResolver = this.setupFnResolver;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 return browserProxy.whenCalled('saveShowDetailsToPrefs'); 206 return browserProxy.whenCalled('saveShowDetailsToPrefs');
207 }).then(function(expanded) { 207 }).then(function(expanded) {
208 assertFalse(Boolean(expanded)); 208 assertFalse(Boolean(expanded));
209 }); 209 });
210 }); 210 });
211 }); 211 });
212 212
213 // Run all registered tests. 213 // Run all registered tests.
214 mocha.run(); 214 mocha.run();
215 }); 215 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/bluetooth_internals_browsertest.js ('k') | content/test/data/web_ui_mojo.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698