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

Side by Side Diff: client/tests/client/dom/WindowNSMETest.dart

Issue 10191033: test renaming overhaul: step 4 client tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 #library('WindowNSMETest');
6 #import('../../../../lib/unittest/unittest.dart');
7 #import('../../../../lib/unittest/dom_config.dart');
8 #import('dart:dom', prefix: 'dom');
9
10 // Not defined in dom.Window.
11 foo(x) => x;
12
13 class Unused {
14 foo(x) => 'not $x';
15 }
16
17 int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
18
19 main() {
20 useDomConfiguration();
21 var things = [new Unused(), dom.window];
22
23 test('windowNonMethod', () {
24 var win = things[inscrutable(1)];
25 final message = foo("Hello World");
26 try {
27 String x = win.foo(message);
28 Expect.fail('Should not reach here: $x');
29 } catch (NoSuchMethodException e) {
30 // Expected exception.
31 } catch (Exception e) {
32 Expect.fail('Wrong exception: $e');
33 }
34 });
35
36 test('foo', () {
37 var win = things[inscrutable(0)];
38 String x = win.foo('bar');
39 Expect.equals('not bar', x);
40 });
41
42 // Use dom.window direclty in case the compiler does type inference.
43 test('windowNonMethod2', () {
44 final message = foo("Hello World");
45 try {
46 String x = dom.window.foo(message);
47 Expect.fail('Should not reach here: $x');
48 } catch (NoSuchMethodException e) {
49 // Expected exception.
50 } catch (Exception e) {
51 Expect.fail('Wrong exception: $e');
52 }
53 });
54 }
OLDNEW
« no previous file with comments | « client/tests/client/dom/WindowManglingTest.dart ('k') | client/tests/client/dom/WindowOpenTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698