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

Side by Side Diff: runtime/bin/vmservice/observatory/test/string_escaping_test.dart

Issue 561053003: Give fields a model class in the service library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: build Created 6 years, 3 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
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library string_escaping_test; 5 library string_escaping_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:mirrors'; 8 import 'dart:mirrors';
9 import 'package:observatory/service_io.dart'; 9 import 'package:observatory/service_io.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 for (int i = 0; i < 512; i++) longStringEven += "𝄞"; 42 for (int i = 0; i < 512; i++) longStringEven += "𝄞";
43 longStringOdd = "."; 43 longStringOdd = ".";
44 for (int i = 0; i < 512; i++) longStringOdd += "𝄞"; 44 for (int i = 0; i < 512; i++) longStringOdd += "𝄞";
45 } 45 }
46 46
47 var tests = [ 47 var tests = [
48 48
49 (Isolate isolate) => 49 (Isolate isolate) =>
50 isolate.rootLib.load().then((Library lib) { 50 isolate.rootLib.load().then((Library lib) {
51 expectFullString(String varName, String varValueAsString) { 51 expectFullString(String varName, String varValueAsString) {
52 ServiceMap field = lib.variables.singleWhere((v) => v.name == varName); 52 Field field = lib.variables.singleWhere((v) => v.name == varName);
53 Instance value = field['value']; 53 Instance value = field.value;
54 expect(value.valueAsString, equals(varValueAsString)); 54 expect(value.valueAsString, equals(varValueAsString));
55 expect(value.valueAsStringIsTruncated, isFalse); 55 expect(value.valueAsStringIsTruncated, isFalse);
56 } 56 }
57 expectTruncatedString(String varName, String varValueAsString) { 57 expectTruncatedString(String varName, String varValueAsString) {
58 ServiceMap field = lib.variables.singleWhere((v) => v.name == varName); 58 Field field = lib.variables.singleWhere((v) => v.name == varName);
59 Instance value = field['value']; 59 Instance value = field.value;
60 expect(varValueAsString, startsWith(value.valueAsString)); 60 expect(varValueAsString, startsWith(value.valueAsString));
61 expect(value.valueAsStringIsTruncated, isTrue); 61 expect(value.valueAsStringIsTruncated, isTrue);
62 } 62 }
63 63
64 script(); // Need to initialize variables in the testing isolate. 64 script(); // Need to initialize variables in the testing isolate.
65 expectFullString('ascii', ascii); 65 expectFullString('ascii', ascii);
66 expectFullString('latin1', latin1); 66 expectFullString('latin1', latin1);
67 expectFullString('unicode', unicode); 67 expectFullString('unicode', unicode);
68 expectFullString('hebrew', hebrew); 68 expectFullString('hebrew', hebrew);
69 expectFullString('singleQuotes', singleQuotes); 69 expectFullString('singleQuotes', singleQuotes);
70 expectFullString('doubleQuotes', doubleQuotes); 70 expectFullString('doubleQuotes', doubleQuotes);
71 expectFullString('newLines', newLines); 71 expectFullString('newLines', newLines);
72 expectFullString('tabs', tabs); 72 expectFullString('tabs', tabs);
73 expectFullString('suggrogatePairs', suggrogatePairs); 73 expectFullString('suggrogatePairs', suggrogatePairs);
74 expectFullString('nullInTheMiddle', nullInTheMiddle); /// 01: ok 74 expectFullString('nullInTheMiddle', nullInTheMiddle); /// 01: ok
75 expectTruncatedString('longStringEven', longStringEven); 75 expectTruncatedString('longStringEven', longStringEven);
76 expectTruncatedString('longStringOdd', longStringOdd); 76 expectTruncatedString('longStringOdd', longStringOdd);
77 }), 77 }),
78 78
79 ]; 79 ];
80 80
81 main(args) => runIsolateTests(args, tests, testeeBefore: script); 81 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698