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

Unified Diff: third_party/pkg/route_hierarchical/example/full/data.dart

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/route_hierarchical/example/full/data.dart
diff --git a/third_party/pkg/route_hierarchical/example/full/data.dart b/third_party/pkg/route_hierarchical/example/full/data.dart
new file mode 100644
index 0000000000000000000000000000000000000000..274a0c54dd4f31dfedfe6656c5365d4112f4864a
--- /dev/null
+++ b/third_party/pkg/route_hierarchical/example/full/data.dart
@@ -0,0 +1,51 @@
+/**
+ * Mock implementation of the data service library.
+ */
+library dataservice;
+
+import 'dart:async';
+
+// List of fake companies
+List _companies = [
+ {
+ 'id': 100001,
+ 'name': 'Company 100001',
+ 'revenue': 3000000.00
+ },
+ {
+ 'id': 111111,
+ 'name': 'Company 1111111',
+ 'revenue': 1001100.00
+ },
+ {
+ 'id': 100003,
+ 'name': 'Mom & Pop Shop',
+ 'revenue': 201000.00
+ },
+ {
+ 'id': 333333,
+ 'name': 'Sunny & Bob',
+ 'revenue': 301000.00
+ },
+ {
+ 'id': 444444,
+ 'name': 'Sun In the Sky Inc.',
+ 'revenue': 5001000.00
+ },
+ {
+ 'id': 555555,
+ 'name': 'Sunny Java',
+ 'revenue': 401000.00
+ }
+];
+
+/// simulate an RPC call to fetch companies
+Future<List<Map>> fetchCompanies(String query) =>
+ new Future.delayed(new Duration(milliseconds: 500), () =>
+ _companies.where((company) =>
+ company['name'].toLowerCase().indexOf(query.toLowerCase()) > -1));
+
+/// simulate an RPC call to fetch a company
+Future<Map> fetchCompany(int id) =>
+ new Future.delayed(new Duration(seconds: 1), () =>
+ _companies.firstWhere((c) => c['id'] == id, orElse: () => null));

Powered by Google App Engine
This is Rietveld 408576698