summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-16 16:13:40 +0000
committerbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-16 16:13:40 +0000
commit04081202c89d1847b511a7cbddcfff806cae9561 (patch)
tree61bbd1377f6b2fb13d040e49c0f9d4cfccd32151
parent7a80eebfcb0ab494b5ea2573e35bd5154981b252 (diff)
downloadchromium_src-04081202c89d1847b511a7cbddcfff806cae9561.zip
chromium_src-04081202c89d1847b511a7cbddcfff806cae9561.tar.gz
chromium_src-04081202c89d1847b511a7cbddcfff806cae9561.tar.bz2
Refine chrome API dart generator tests.
The two tests for dictionary generation have been merged into one, which also tests a bit more stuff. BUG=None Review URL: https://chromiumcodereview.appspot.com/12878004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188587 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xtools/json_schema_compiler/dart_generator_test.py7
-rw-r--r--tools/json_schema_compiler/dart_test/basic_type.dart77
-rw-r--r--tools/json_schema_compiler/dart_test/basic_type.idl20
-rw-r--r--tools/json_schema_compiler/dart_test/complex_type.dart86
-rw-r--r--tools/json_schema_compiler/dart_test/complex_type.idl23
-rw-r--r--tools/json_schema_compiler/dart_test/dictionaries.dart231
-rw-r--r--tools/json_schema_compiler/dart_test/dictionaries.idl60
7 files changed, 293 insertions, 211 deletions
diff --git a/tools/json_schema_compiler/dart_generator_test.py b/tools/json_schema_compiler/dart_generator_test.py
index 8fcdb59..283918d 100755
--- a/tools/json_schema_compiler/dart_generator_test.py
+++ b/tools/json_schema_compiler/dart_generator_test.py
@@ -56,14 +56,11 @@ class DartTest(unittest.TestCase):
def testBasicFunction(self):
self._RunTest('basic_function')
- def testBasicType(self):
- self._RunTest('basic_type')
-
def testComments(self):
self._RunTest('comments')
- def testComplexType(self):
- self._RunTest('complex_type')
+ def testDictionaries(self):
+ self._RunTest('dictionaries')
def testEmptyNamespace(self):
self._RunTest('empty_namespace')
diff --git a/tools/json_schema_compiler/dart_test/basic_type.dart b/tools/json_schema_compiler/dart_test/basic_type.dart
deleted file mode 100644
index 53183d0..0000000
--- a/tools/json_schema_compiler/dart_test/basic_type.dart
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Generated from namespace: basic_type
-
-part of chrome;
-
-/**
- * Types
- */
-
-class Basic_typeBasicType extends ChromeObject {
- /*
- * Public constructor
- */
- Basic_typeBasicType({String s, int i, int l, double d}) {
- if (?s)
- this.s = s;
- if (?i)
- this.i = i;
- if (?l)
- this.l = l;
- if (?d)
- this.d = d;
- }
-
- /*
- * Private constructor
- */
- Basic_typeBasicType._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// Documentation for the String s.
- String get s => JS('String', '#.s', this._jsObject);
-
- void set s(String s) {
- JS('void', '#.s = #', this._jsObject, s);
- }
-
- /// Documentation for the int i.
- int get i => JS('int', '#.i', this._jsObject);
-
- void set i(int i) {
- JS('void', '#.i = #', this._jsObject, i);
- }
-
- /// Documentation for the long l.
- int get l => JS('int', '#.l', this._jsObject);
-
- void set l(int l) {
- JS('void', '#.l = #', this._jsObject, l);
- }
-
- /// Documentation for the double d.
- double get d => JS('double', '#.d', this._jsObject);
-
- void set d(double d) {
- JS('void', '#.d = #', this._jsObject, d);
- }
-
-}
-
-/**
- * Functions
- */
-
-class API_basic_type {
- /*
- * API connection
- */
- Object _jsObject;
- API_basic_type(this._jsObject) {
- }
-}
diff --git a/tools/json_schema_compiler/dart_test/basic_type.idl b/tools/json_schema_compiler/dart_test/basic_type.idl
deleted file mode 100644
index 52837f8..0000000
--- a/tools/json_schema_compiler/dart_test/basic_type.idl
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-namespace basic_type {
- // Documentation for BasicType.
- dictionary BasicType {
- // Documentation for the String s.
- DOMString s;
-
- // Documentation for the int i.
- int i;
-
- // Documentation for the long l.
- long l;
-
- // Documentation for the double d.
- double d;
- };
-};
diff --git a/tools/json_schema_compiler/dart_test/complex_type.dart b/tools/json_schema_compiler/dart_test/complex_type.dart
deleted file mode 100644
index f66821a..0000000
--- a/tools/json_schema_compiler/dart_test/complex_type.dart
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Generated from namespace: complex_type
-
-part of chrome;
-
-/**
- * Types
- */
-
-class Complex_typeComplexType extends ChromeObject {
- /*
- * Public constructor
- */
- Complex_typeComplexType({String s, int i, int l, double d, Complex_typeComplexType c}) {
- if (?s)
- this.s = s;
- if (?i)
- this.i = i;
- if (?l)
- this.l = l;
- if (?d)
- this.d = d;
- if (?c)
- this.c = c;
- }
-
- /*
- * Private constructor
- */
- Complex_typeComplexType._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// Documentation for the String s.
- String get s => JS('String', '#.s', this._jsObject);
-
- void set s(String s) {
- JS('void', '#.s = #', this._jsObject, s);
- }
-
- /// Documentation for the int i.
- int get i => JS('int', '#.i', this._jsObject);
-
- void set i(int i) {
- JS('void', '#.i = #', this._jsObject, i);
- }
-
- /// Documentation for the long l.
- int get l => JS('int', '#.l', this._jsObject);
-
- void set l(int l) {
- JS('void', '#.l = #', this._jsObject, l);
- }
-
- /// Documentation for the double d.
- double get d => JS('double', '#.d', this._jsObject);
-
- void set d(double d) {
- JS('void', '#.d = #', this._jsObject, d);
- }
-
- /// Documentation for the ComplexType c.
- Complex_typeComplexType get c => new Complex_typeComplexType._proxy(JS('', '#.c', this._jsObject));
-
- void set c(Complex_typeComplexType c) {
- JS('void', '#.c = #', this._jsObject, convertArgument(c));
- }
-
-}
-
-/**
- * Functions
- */
-
-class API_complex_type {
- /*
- * API connection
- */
- Object _jsObject;
- API_complex_type(this._jsObject) {
- }
-}
diff --git a/tools/json_schema_compiler/dart_test/complex_type.idl b/tools/json_schema_compiler/dart_test/complex_type.idl
deleted file mode 100644
index c75f97e..0000000
--- a/tools/json_schema_compiler/dart_test/complex_type.idl
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-namespace complex_type {
- // Documentation for ComplexType.
- dictionary ComplexType {
- // Documentation for the String s.
- DOMString s;
-
- // Documentation for the int i.
- int i;
-
- // Documentation for the long l.
- long l;
-
- // Documentation for the double d.
- double d;
-
- // Documentation for the ComplexType c.
- ComplexType c;
- };
-};
diff --git a/tools/json_schema_compiler/dart_test/dictionaries.dart b/tools/json_schema_compiler/dart_test/dictionaries.dart
new file mode 100644
index 0000000..770efa6
--- /dev/null
+++ b/tools/json_schema_compiler/dart_test/dictionaries.dart
@@ -0,0 +1,231 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Generated from namespace: dictionaries
+
+part of chrome;
+
+/**
+ * Types
+ */
+
+class DictionariesInnerType extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ DictionariesInnerType({String s, int b, int i, int l, double d, FileEntry f, String os, int ob, int oi, int ol, double od, FileEntry of}) {
+ if (?s)
+ this.s = s;
+ if (?b)
+ this.b = b;
+ if (?i)
+ this.i = i;
+ if (?l)
+ this.l = l;
+ if (?d)
+ this.d = d;
+ if (?f)
+ this.f = f;
+ if (?os)
+ this.os = os;
+ if (?ob)
+ this.ob = ob;
+ if (?oi)
+ this.oi = oi;
+ if (?ol)
+ this.ol = ol;
+ if (?od)
+ this.od = od;
+ if (?of)
+ this.of = of;
+ }
+
+ /*
+ * Private constructor
+ */
+ DictionariesInnerType._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// Documentation for the String s.
+ String get s => JS('String', '#.s', this._jsObject);
+
+ void set s(String s) {
+ JS('void', '#.s = #', this._jsObject, s);
+ }
+
+ /// Documentation for the boolean b.
+ int get b => JS('int', '#.b', this._jsObject);
+
+ void set b(int b) {
+ JS('void', '#.b = #', this._jsObject, b);
+ }
+
+ /// Documentation for the int i.
+ int get i => JS('int', '#.i', this._jsObject);
+
+ void set i(int i) {
+ JS('void', '#.i = #', this._jsObject, i);
+ }
+
+ /// Documentation for the long l.
+ int get l => JS('int', '#.l', this._jsObject);
+
+ void set l(int l) {
+ JS('void', '#.l = #', this._jsObject, l);
+ }
+
+ /// Documentation for the double d.
+ double get d => JS('double', '#.d', this._jsObject);
+
+ void set d(double d) {
+ JS('void', '#.d = #', this._jsObject, d);
+ }
+
+ /// Documentation for the file entry f.
+ FileEntry get f => JS('FileEntry', '#.f', this._jsObject);
+
+ void set f(FileEntry f) {
+ JS('void', '#.f = #', this._jsObject, convertArgument(f));
+ }
+
+ /// Documentation for the optional String s.
+ String get os => JS('String', '#.os', this._jsObject);
+
+ void set os(String os) {
+ JS('void', '#.os = #', this._jsObject, os);
+ }
+
+ /// Documentation for the optional boolean ob.
+ int get ob => JS('int', '#.ob', this._jsObject);
+
+ void set ob(int ob) {
+ JS('void', '#.ob = #', this._jsObject, ob);
+ }
+
+ /// Documentation for the optional int i.
+ int get oi => JS('int', '#.oi', this._jsObject);
+
+ void set oi(int oi) {
+ JS('void', '#.oi = #', this._jsObject, oi);
+ }
+
+ /// Documentation for the optional long l.
+ int get ol => JS('int', '#.ol', this._jsObject);
+
+ void set ol(int ol) {
+ JS('void', '#.ol = #', this._jsObject, ol);
+ }
+
+ /// Documentation for the optional double d.
+ double get od => JS('double', '#.od', this._jsObject);
+
+ void set od(double od) {
+ JS('void', '#.od = #', this._jsObject, od);
+ }
+
+ /// Documentation for the optional file entry f.
+ FileEntry get of => JS('FileEntry', '#.of', this._jsObject);
+
+ void set of(FileEntry of) {
+ JS('void', '#.of = #', this._jsObject, convertArgument(of));
+ }
+
+}
+
+class DictionariesOuterType extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ DictionariesOuterType({List<DictionariesInnerType> items, List<DictionariesInnerType> oitems}) {
+ if (?items)
+ this.items = items;
+ if (?oitems)
+ this.oitems = oitems;
+ }
+
+ /*
+ * Private constructor
+ */
+ DictionariesOuterType._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// Documentation for the array of InnerTypes items.
+ List<DictionariesInnerType> get items {
+ List<DictionariesInnerType> __proxy_items = new List<DictionariesInnerType>();
+ for (var o in JS('List', '#.items', this._jsObject)) {
+ __proxy_items.add(new DictionariesInnerType._proxy(o));
+ }
+ return __proxy_items;
+ }
+
+ void set items(List<DictionariesInnerType> items) {
+ JS('void', '#.items = #', this._jsObject, convertArgument(items));
+ }
+
+ /// Documentation for the optional array of Inner Types oitems.
+ List<DictionariesInnerType> get oitems {
+ List<DictionariesInnerType> __proxy_oitems = new List<DictionariesInnerType>();
+ for (var o in JS('List', '#.oitems', this._jsObject)) {
+ __proxy_oitems.add(new DictionariesInnerType._proxy(o));
+ }
+ return __proxy_oitems;
+ }
+
+ void set oitems(List<DictionariesInnerType> oitems) {
+ JS('void', '#.oitems = #', this._jsObject, convertArgument(oitems));
+ }
+
+}
+
+class DictionariesComplexType extends ChromeObject {
+ /*
+ * Public constructor
+ */
+ DictionariesComplexType({int i, DictionariesComplexType c}) {
+ if (?i)
+ this.i = i;
+ if (?c)
+ this.c = c;
+ }
+
+ /*
+ * Private constructor
+ */
+ DictionariesComplexType._proxy(_jsObject) : super._proxy(_jsObject);
+
+ /*
+ * Public accessors
+ */
+ /// Documentation for the int i.
+ int get i => JS('int', '#.i', this._jsObject);
+
+ void set i(int i) {
+ JS('void', '#.i = #', this._jsObject, i);
+ }
+
+ /// Documentation for the ComplexType c.
+ DictionariesComplexType get c => new DictionariesComplexType._proxy(JS('', '#.c', this._jsObject));
+
+ void set c(DictionariesComplexType c) {
+ JS('void', '#.c = #', this._jsObject, convertArgument(c));
+ }
+
+}
+
+/**
+ * Functions
+ */
+
+class API_dictionaries {
+ /*
+ * API connection
+ */
+ Object _jsObject;
+ API_dictionaries(this._jsObject) {
+ }
+}
diff --git a/tools/json_schema_compiler/dart_test/dictionaries.idl b/tools/json_schema_compiler/dart_test/dictionaries.idl
new file mode 100644
index 0000000..4b26684
--- /dev/null
+++ b/tools/json_schema_compiler/dart_test/dictionaries.idl
@@ -0,0 +1,60 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+namespace dictionaries {
+ // Documentation for ComplexType.
+ dictionary InnerType {
+ // Documentation for the String s.
+ DOMString s;
+
+ // Documentation for the boolean b.
+ int b;
+
+ // Documentation for the int i.
+ int i;
+
+ // Documentation for the long l.
+ long l;
+
+ // Documentation for the double d.
+ double d;
+
+ // Documentation for the file entry f.
+ [instanceOf=FileEntry] object f;
+
+ // Documentation for the optional String s.
+ DOMString? os;
+
+ // Documentation for the optional boolean ob.
+ int ob;
+
+ // Documentation for the optional int i.
+ int? oi;
+
+ // Documentation for the optional long l.
+ long? ol;
+
+ // Documentation for the optional double d.
+ double? od;
+
+ // Documentation for the optional file entry f.
+ [instanceOf=FileEntry] object? of;
+ };
+
+ dictionary OuterType {
+ // Documentation for the array of InnerTypes items.
+ InnerType[] items;
+
+ // Documentation for the optional array of Inner Types oitems.
+ InnerType[]? oitems;
+ };
+
+ dictionary ComplexType {
+ // Documentation for the int i.
+ int i;
+
+ // Documentation for the ComplexType c.
+ ComplexType c;
+ };
+};