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

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

Issue 2590393002: Revert of Mojo JS bindings: switch most usage of "connection"/"router" module to "bindings". (Closed)
Patch Set: 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
60 /** 58 /**
61 * The data to be returned by |getPluginsData_|. 59 * The data to be returned by |getPluginsData_|.
62 * @private 60 * @private
63 */ 61 */
64 this.pluginsData_ = []; 62 this.pluginsData_ = [];
65 }; 63 };
66 64
67 TestBrowserProxy.prototype = { 65 TestBrowserProxy.prototype = {
68 __proto__: settings.TestBrowserProxy.prototype, 66 __proto__: settings.TestBrowserProxy.prototype,
69 67
(...skipping 21 matching lines...) Expand all
91 }; 89 };
92 90
93 this.browserProxy = new TestBrowserProxy(); 91 this.browserProxy = new TestBrowserProxy();
94 92
95 // A function that is called from chrome://plugins to allow this test to 93 // A function that is called from chrome://plugins to allow this test to
96 // replace the real Mojo browser proxy with a fake one, before any other 94 // replace the real Mojo browser proxy with a fake one, before any other
97 // code runs. 95 // code runs.
98 window.setupFn = function() { 96 window.setupFn = function() {
99 return importModules([ 97 return importModules([
100 'mojo/public/js/bindings', 98 'mojo/public/js/bindings',
99 'mojo/public/js/connection',
101 'chrome/browser/ui/webui/plugins/plugins.mojom', 100 'chrome/browser/ui/webui/plugins/plugins.mojom',
102 'content/public/renderer/frame_interfaces', 101 'content/public/renderer/frame_interfaces',
103 ]).then(function(modules) { 102 ]).then(function(modules) {
104 var bindings = modules[0]; 103 var bindings = modules[0];
105 var pluginsMojom = modules[1]; 104 var connection = modules[1];
106 var frameInterfaces = modules[2]; 105 var pluginsMojom = modules[2];
106 var frameInterfaces = modules[3];
107 107
108 this.browserProxy.bindingSet = new bindings.BindingSet(
109 pluginsMojom.PluginsPageHandler);
110 frameInterfaces.addInterfaceOverrideForTesting( 108 frameInterfaces.addInterfaceOverrideForTesting(
111 pluginsMojom.PluginsPageHandler.name, function(handle) { 109 pluginsMojom.PluginsPageHandler.name, function(handle) {
112 this.browserProxy.bindingSet.addBinding(this.browserProxy, 110 var stub = connection.bindHandleToStub(
113 handle); 111 handle, pluginsMojom.PluginsPageHandler);
112 bindings.StubBindings(stub).delegate = this.browserProxy;
114 }.bind(this)); 113 }.bind(this));
115 return this.setupFnResolver.promise; 114 return this.setupFnResolver.promise;
116 }.bind(this)); 115 }.bind(this));
117 }.bind(this); 116 }.bind(this);
118 }, 117 },
119 }; 118 };
120 119
121 TEST_F('PluginsTest', 'Plugins', function() { 120 TEST_F('PluginsTest', 'Plugins', function() {
122 var browserProxy = this.browserProxy; 121 var browserProxy = this.browserProxy;
123 var setupFnResolver = this.setupFnResolver; 122 var setupFnResolver = this.setupFnResolver;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 return browserProxy.whenCalled('saveShowDetailsToPrefs'); 206 return browserProxy.whenCalled('saveShowDetailsToPrefs');
208 }).then(function(expanded) { 207 }).then(function(expanded) {
209 assertFalse(Boolean(expanded)); 208 assertFalse(Boolean(expanded));
210 }); 209 });
211 }); 210 });
212 }); 211 });
213 212
214 // Run all registered tests. 213 // Run all registered tests.
215 mocha.run(); 214 mocha.run();
216 }); 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