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

Unified Diff: tests/html/websql_test.dart

Issue 12050005: Adding supported checks to websql. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/html.status ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/websql_test.dart
diff --git a/tests/html/websql_test.dart b/tests/html/websql_test.dart
index 338c618a9e026b7f3d9e6d9ec036e90af9db0698..16871b8f63437fbcd2b99cb65366dccdf8d684cb 100644
--- a/tests/html/websql_test.dart
+++ b/tests/html/websql_test.dart
@@ -1,6 +1,6 @@
library WebDBTest;
import '../../pkg/unittest/lib/unittest.dart';
-import '../../pkg/unittest/lib/html_config.dart';
+import '../../pkg/unittest/lib/html_individual_config.dart';
import 'dart:async';
import 'dart:html';
@@ -87,31 +87,51 @@ dropTable(tableName, [bool ignoreFailure = false]) =>
};
main() {
- useHtmlConfiguration();
-
- test('Web Database', () {
- final tableName = 'test_table';
- final columnName = 'test_data';
-
- final db = window.openDatabase('test_db', '1.0', 'test_db', 1024 * 1024);
-
- expect(db, isNotNull, reason: 'Unable to open database');
-
- createTransaction(db)
- // Attempt to clear out any tables which may be lurking from previous
- // runs.
- .then(dropTable(tableName, true))
- .then(createTable(tableName, columnName))
- .then(insert(tableName, columnName, 'Some text data'))
- .then(queryTable(tableName, (resultSet) {
- guardAsync(() {
- expect(resultSet.rows.length, 1);
- var row = resultSet.rows.item(0);
- expect(row.containsKey(columnName), isTrue);
- expect(row[columnName], 'Some text data');
- });
- }))
- .then(dropTable(tableName))
- .then(expectAsync1((tx) {}));
+ useHtmlIndividualConfiguration();
+
+ group('supported', () {
+ test('supported', () {
+ expect(Database.supported, true);
+ });
+ });
+
+ group('functional', () {
+ test('unsupported throws', () {
+ var expectation = Database.supported ? returnsNormally : throws;
+ expect(() {
+ window.openDatabase('test_db', '1.0', 'test_db', 1024 * 1024);
+ }, expectation);
+
+ });
+ test('Web Database', () {
+ // Skip if not supported.
+ if (!Database.supported) {
+ return;
+ }
+
+ final tableName = 'test_table';
+ final columnName = 'test_data';
+
+ final db = window.openDatabase('test_db', '1.0', 'test_db', 1024 * 1024);
+
+ expect(db, isNotNull, reason: 'Unable to open database');
+
+ createTransaction(db)
+ // Attempt to clear out any tables which may be lurking from previous
+ // runs.
+ .then(dropTable(tableName, true))
+ .then(createTable(tableName, columnName))
+ .then(insert(tableName, columnName, 'Some text data'))
+ .then(queryTable(tableName, (resultSet) {
+ guardAsync(() {
+ expect(resultSet.rows.length, 1);
+ var row = resultSet.rows.item(0);
+ expect(row.containsKey(columnName), isTrue);
+ expect(row[columnName], 'Some text data');
+ });
+ }))
+ .then(dropTable(tableName))
+ .then(expectAsync1((tx) {}));
+ });
});
}
« no previous file with comments | « tests/html/html.status ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698