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

Unified Diff: tests/html/storage_quota_test.dart

Issue 658903005: Reapply "Stop suppressing generation of bindings with Promise. Add some tests for DOM APIs that ans… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
« no previous file with comments | « tests/html/html.status ('k') | tools/dom/dom.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/storage_quota_test.dart
diff --git a/tests/html/storage_quota_test.dart b/tests/html/storage_quota_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..54e53464d71101c8a892b9ade5b36076d441bc41
--- /dev/null
+++ b/tests/html/storage_quota_test.dart
@@ -0,0 +1,38 @@
+library storage_quota_test;
+
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+
+import 'dart:async';
+import 'dart:isolate';
+import 'dart:html';
+
+main() {
+ useHtmlConfiguration();
+
+ expectSaneStorageInfo(StorageInfo storageInfo) {
+ expect(storageInfo.usage, isNotNull);
+ expect(storageInfo.quota, isNotNull);
+ expect(storageInfo.usage >= 0, isTrue);
+ expect(storageInfo.quota >= storageInfo.usage, isNotNull);
+ };
+
+ test('storage quota - temporary', () {
+ Future f = window.navigator.storageQuota.queryInfo('temporary');
+ expect(f.then(expectSaneStorageInfo), completes);
+ });
+
+ test('storage quota - persistent', () {
+ Future f = window.navigator.storageQuota.queryInfo('persistent');
+ expect(f.then(expectSaneStorageInfo), completes);
+ });
+
+ test('storage quota - unknown', () {
+ // Throwing synchronously is bogus upstream behavior; should result in a
+ // smashed promise.
+ expect(() => window.navigator.storageQuota.queryInfo("foo"), throws); /// missingenumcheck: ok
+ var wrongType = 3;
+ expect(() => window.navigator.storageQuota.queryInfo(wrongType), throws);
+ expect(() => window.navigator.storageQuota.queryInfo(null), throws);
+ });
+}
« no previous file with comments | « tests/html/html.status ('k') | tools/dom/dom.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698