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

Side by Side Diff: samples/third_party/dromaeo/web/Suites.dart

Issue 1576153002: Remove the Dromaeo and TodoMVC samples. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « samples/third_party/dromaeo/web/README ('k') | samples/third_party/dromaeo/web/application.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 library Suites;
2
3 class Origin {
4 final String author;
5 final String url;
6
7 const Origin(this.author, this.url);
8 }
9
10 class SuiteDescription {
11 final String file;
12 final String name;
13 final Origin origin;
14 final String description;
15 final List<String> tags;
16 final List testVariants;
17
18 const SuiteDescription(this.file, this.name, this.origin,
19 this.description, this.tags, this.testVariants);
20 }
21
22 class Suites {
23 static const JOHN_RESIG = const Origin('John Resig', 'http://ejohn.org/');
24
25 static const CATEGORIES = const {
26 // Platform tags
27 'js': 'DOM Core Tests (JavaScript)',
28 'dart': 'DOM Core Tests (dart)',
29 'dart2js': 'DOM Core Tests (dart2js)',
30
31 // Library tags
32 'html': 'DOM Core Tests (dart:html)',
33 };
34
35 static const _CORE_TEST_OPTIONS = const [
36 // A list of valid combinations for core Dromaeo DOM tests.
37 // Each item in the list is a pair of (platform x [variants]).
38 const ['js', const ['']],
39 const ['dart', const ['html']],
40 const ['dart2js', const ['html']],
41 ];
42
43 static const _CORE_SUITE_DESCRIPTIONS = const [
44 const SuiteDescription(
45 'tests/dom-attr.html',
46 'DOM Attributes',
47 JOHN_RESIG,
48 'Setting and getting DOM node attributes',
49 const ['attributes'],
50 _CORE_TEST_OPTIONS),
51 const SuiteDescription(
52 'tests/dom-modify.html',
53 'DOM Modification',
54 JOHN_RESIG,
55 'Creating and injecting DOM nodes into a document',
56 const ['modify'],
57 _CORE_TEST_OPTIONS),
58 const SuiteDescription(
59 'tests/dom-query.html',
60 'DOM Query',
61 JOHN_RESIG,
62 'Querying DOM elements in a document',
63 const ['query'],
64 _CORE_TEST_OPTIONS),
65 const SuiteDescription(
66 'tests/dom-traverse.html',
67 'DOM Traversal',
68 JOHN_RESIG,
69 'Traversing a DOM structure',
70 const ['traverse'],
71 _CORE_TEST_OPTIONS),
72 const SuiteDescription(
73 '/root_dart/tests/html/dromaeo_smoke.html',
74 'Smoke test',
75 const Origin('', ''),
76 'Dromaeo no-op smoke test',
77 const ['nothing'],
78 _CORE_TEST_OPTIONS),
79 ];
80
81 // Mappings from original path to actual path given platform/library.
82 static _getHtmlPathForVariant(platform, lib, path) {
83 if (lib != '') {
84 lib = '-$lib';
85 }
86 switch (platform) {
87 case 'js':
88 case 'dart':
89 return path.replaceFirst('.html', '$lib.html');
90 case 'dart2js':
91 int i = path.indexOf('/');
92 String topLevelDir = '';
93 if (i != -1) topLevelDir = '${path.substring(0, i)}';
94 return '$topLevelDir/'
95 '${path.substring(i + 1).replaceFirst(".html", "$lib-js.html")}';
96 }
97 }
98
99 static var _SUITE_DESCRIPTIONS;
100
101 static List<SuiteDescription> get SUITE_DESCRIPTIONS {
102 if (_SUITE_DESCRIPTIONS != null) {
103 return _SUITE_DESCRIPTIONS;
104 }
105 _SUITE_DESCRIPTIONS = <SuiteDescription>[];
106
107 // Expand the list to include a unique SuiteDescription for each
108 // tested variant.
109 for (SuiteDescription suite in _CORE_SUITE_DESCRIPTIONS) {
110 List variants = suite.testVariants;
111 for (List variant in variants) {
112 assert(variant.length == 2);
113 String platform = variant[0];
114 List<String> libraries = variant[1];
115 for(String lib in libraries) {
116 String path = _getHtmlPathForVariant(platform, lib, suite.file);
117 final combined = new List.from(suite.tags);
118 combined.add(platform);
119 if (lib != '') {
120 combined.add(lib);
121 lib = ':$lib';
122 }
123 final name = (variant == null)
124 ? suite.name
125 : '${suite.name} ($platform$lib)';
126 _SUITE_DESCRIPTIONS.add(new SuiteDescription(
127 path,
128 name,
129 suite.origin,
130 suite.description,
131 combined,
132 []));
133 }
134 }
135 }
136
137 return _SUITE_DESCRIPTIONS;
138 }
139
140 static List<SuiteDescription> getSuites(String tags) {
141 // Allow AND and OR in place of '&' and '|' for browsers where
142 // those symbols are escaped.
143 tags = tags.replaceAll('OR', '|').replaceAll('AND', '&');
144 // A disjunction of conjunctions (e.g.,
145 // 'js&modify|dart&dom&modify').
146 final taglist = tags.split('|').map((tag) => tag.split('&')).toList();
147
148 bool match(suite) {
149 // If any conjunction matches, return true.
150 for (final tagset in taglist) {
151 if (tagset.every((tag) => suite.tags.indexOf(tag) >= 0)) {
152 return true;
153 }
154 }
155 return false;
156 }
157 final suites = SUITE_DESCRIPTIONS.where(match).toList();
158
159 suites.sort((s1, s2) => s1.name.compareTo(s2.name));
160 return suites;
161 }
162
163 static getCategory(String tags) {
164 if (CATEGORIES.containsKey(tags)) {
165 return CATEGORIES[tags];
166 }
167 for (final suite in _CORE_SUITE_DESCRIPTIONS) {
168 if (suite.tags[0] == tags) {
169 return suite.name;
170 }
171 }
172 return null;
173 }
174 }
OLDNEW
« no previous file with comments | « samples/third_party/dromaeo/web/README ('k') | samples/third_party/dromaeo/web/application.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698