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

Unified Diff: tests/compiler/dart2js_native/native_novel_html_test.dart

Issue 11552012: Address code-review comments for https://codereview.chromium.org//11553015 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/native_helper.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js_native/native_novel_html_test.dart
diff --git a/tests/compiler/dart2js_native/native_novel_html_test.dart b/tests/compiler/dart2js_native/native_novel_html_test.dart
index 17de787bf0fec78eb64b10e4eea358dcf51f3757..485d2f6f080e3581b119cf871df3ed8d83a7a3df 100644
--- a/tests/compiler/dart2js_native/native_novel_html_test.dart
+++ b/tests/compiler/dart2js_native/native_novel_html_test.dart
@@ -5,8 +5,8 @@
// Test to see if novel HTML tags are interpreted as HTMLElement.
class Element native "*HTMLElement" {
- String foo(int x) => '[${bar(x+1)}]';
- String bar(int x) native;
+ String dartMethod(int x) => 'dartMethod(${nativeMethod(x+1)})';
+ String nativeMethod(int x) native;
}
makeE() native;
@@ -15,12 +15,16 @@ makeF() native;
void setup() native """
// A novel HTML element.
function HTMLGoofyElement(){}
-HTMLGoofyElement.prototype.bar = function(a){return 'Goofy.foo(' + a + ')';}
+HTMLGoofyElement.prototype.nativeMethod = function(a) {
+ return 'Goofy.nativeMethod(' + a + ')';
+};
makeE = function(){return new HTMLGoofyElement};
// A non-HTML element with a misleading name.
function HTMLFakeyElement(){}
-HTMLFakeyElement.prototype.bar = function(a){return 'Fakey.foo(' + a + ')';}
+HTMLFakeyElement.prototype.nativeMethod = function(a) {
+ return 'Fakey.nativeMethod(' + a + ')';
+};
makeF = function(){return new HTMLFakeyElement};
// Make the HTMLGoofyElement look like a real host object.
@@ -35,21 +39,13 @@ Object.prototype.toString = function() {
main() {
setup();
- print(123);
var e = makeE();
- Expect.equals('[Goofy.foo(11)]', e.foo(10));
+ Expect.equals('Goofy.nativeMethod(10)', e.nativeMethod(10));
+ Expect.equals('dartMethod(Goofy.nativeMethod(11))', e.dartMethod(10));
var f = makeF();
- expectNoSuchMethod(() => f.foo(20), 'f.foo(20) should fail');
-}
-
-expectNoSuchMethod(action, note) {
- bool caught = false;
- try {
- action();
- } catch (ex) {
- caught = true;
- Expect.isTrue(ex is NoSuchMethodError, note);
- }
- Expect.isTrue(caught, note);
+ Expect.throws(() => f.nativeMethod(20), (e) => e is NoSuchMethodError,
+ 'fake HTML Element must not run Dart method on native class');
+ Expect.throws(() => f.dartMethod(20), (e) => e is NoSuchMethodError,
+ 'fake HTML Element must not run native method on native class');
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/native_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698