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

Side by Side Diff: Source/core/testing/PrivateScriptTest.js

Issue 756053002: [Blink-in-JS] Migrate the PrivateScript specific methods/attributes to ScriptController (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: ScriptController => PrivateScriptController Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "use strict"; 5 "use strict";
6 6
7 installClass("PrivateScriptTest", function(PrivateScriptTestPrototype) { 7 privateScriptController.installClass("PrivateScriptTest", function(PrivateScript TestPrototype) {
8 8
9 PrivateScriptTestPrototype.initialize = function() { 9 PrivateScriptTestPrototype.initialize = function() {
10 this.m_shortAttribute = -1; 10 this.m_shortAttribute = -1;
11 this.m_stringAttribute = "xxx"; 11 this.m_stringAttribute = "xxx";
12 this.m_nodeAttribute = null; 12 this.m_nodeAttribute = null;
13 this.m_stringAttributeForPrivateScriptOnly = "yyy"; 13 this.m_stringAttributeForPrivateScriptOnly = "yyy";
14 } 14 }
15 15
16 PrivateScriptTestPrototype.doNothing = function() { 16 PrivateScriptTestPrototype.doNothing = function() {
17 } 17 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 get: function() { return this.m_stringAttribute; }, 108 get: function() { return this.m_stringAttribute; },
109 set: function(value) { this.m_stringAttribute = value; } 109 set: function(value) { this.m_stringAttribute = value; }
110 }); 110 });
111 111
112 Object.defineProperty(PrivateScriptTestPrototype, "nodeAttribute", { 112 Object.defineProperty(PrivateScriptTestPrototype, "nodeAttribute", {
113 get: function() { return this.m_nodeAttribute; }, 113 get: function() { return this.m_nodeAttribute; },
114 set: function(value) { this.m_nodeAttribute = value; } 114 set: function(value) { this.m_nodeAttribute = value; }
115 }); 115 });
116 116
117 Object.defineProperty(PrivateScriptTestPrototype, "nodeAttributeThrowsIndexS izeError", { 117 Object.defineProperty(PrivateScriptTestPrototype, "nodeAttributeThrowsIndexS izeError", {
118 get: function() { throwException(PrivateScriptDOMException.IndexSizeErro r, "getter threw error"); }, 118 get: function() { privateScriptController.throwException(privateScriptCo ntroller.DOMException.IndexSizeError, "getter threw error"); },
119 set: function(value) { throwException(PrivateScriptDOMException.IndexSiz eError, "setter threw error"); } 119 set: function(value) { privateScriptController.throwException(privateScr iptController.DOMException.IndexSizeError, "setter threw error"); }
120 }); 120 });
121 121
122 PrivateScriptTestPrototype.voidMethodThrowsDOMSyntaxError = function() { 122 PrivateScriptTestPrototype.voidMethodThrowsDOMSyntaxError = function() {
123 throwException(PrivateScriptDOMException.SyntaxError, "method threw erro r"); 123 privateScriptController.throwException(privateScriptController.DOMExcept ion.SyntaxError, "method threw error");
124 } 124 }
125 125
126 PrivateScriptTestPrototype.voidMethodThrowsError = function() { 126 PrivateScriptTestPrototype.voidMethodThrowsError = function() {
127 throwException(PrivateScriptJSError.Error, "method threw Error"); 127 privateScriptController.throwException(privateScriptController.JSError.E rror, "method threw Error");
128 } 128 }
129 129
130 PrivateScriptTestPrototype.voidMethodThrowsTypeError = function() { 130 PrivateScriptTestPrototype.voidMethodThrowsTypeError = function() {
131 throwException(PrivateScriptJSError.TypeError, "method threw TypeError") ; 131 privateScriptController.throwException(privateScriptController.JSError.T ypeError, "method threw TypeError");
132 } 132 }
133 133
134 PrivateScriptTestPrototype.voidMethodThrowsRangeError = function() { 134 PrivateScriptTestPrototype.voidMethodThrowsRangeError = function() {
135 throwException(PrivateScriptJSError.RangeError, "method threw RangeError "); 135 privateScriptController.throwException(privateScriptController.JSError.R angeError, "method threw RangeError");
136 } 136 }
137 137
138 PrivateScriptTestPrototype.voidMethodThrowsSyntaxError = function() { 138 PrivateScriptTestPrototype.voidMethodThrowsSyntaxError = function() {
139 throwException(PrivateScriptJSError.SyntaxError, "method threw SyntaxErr or"); 139 privateScriptController.throwException(privateScriptController.JSError.S yntaxError, "method threw SyntaxError");
140 } 140 }
141 141
142 PrivateScriptTestPrototype.voidMethodThrowsReferenceError = function() { 142 PrivateScriptTestPrototype.voidMethodThrowsReferenceError = function() {
143 throwException(PrivateScriptJSError.ReferenceError, "method threw Refere nceError"); 143 privateScriptController.throwException(privateScriptController.JSError.R eferenceError, "method threw ReferenceError");
144 } 144 }
145 145
146 PrivateScriptTestPrototype.voidMethodThrowsStackOverflowError = function() { 146 PrivateScriptTestPrototype.voidMethodThrowsStackOverflowError = function() {
147 function f() { f(); } 147 function f() { f(); }
148 f(); 148 f();
149 } 149 }
150 150
151 PrivateScriptTestPrototype.addIntegerForPrivateScriptOnly = function(value1, value2) { 151 PrivateScriptTestPrototype.addIntegerForPrivateScriptOnly = function(value1, value2) {
152 return value1 + value2; 152 return value1 + value2;
153 } 153 }
(...skipping 12 matching lines...) Expand all
166 set: function(value) { this.m_stringAttributeImplementedInCPPForPrivateS criptOnly = value; } 166 set: function(value) { this.m_stringAttributeImplementedInCPPForPrivateS criptOnly = value; }
167 }); 167 });
168 168
169 PrivateScriptTestPrototype.dispatchDocumentOnload = function(document) { 169 PrivateScriptTestPrototype.dispatchDocumentOnload = function(document) {
170 var event = new Event("load", { bubbles: true, cancelable: true }); 170 var event = new Event("load", { bubbles: true, cancelable: true });
171 event.valueInPrivateScript = "this should not be visible in user's scrip t"; 171 event.valueInPrivateScript = "this should not be visible in user's scrip t";
172 document.dispatchEvent(event); 172 document.dispatchEvent(event);
173 } 173 }
174 174
175 }); 175 });
OLDNEW
« no previous file with comments | « Source/core/testing/PartialPrivateScriptTest.js ('k') | Source/core/xml/DocumentXMLTreeViewer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698