Refactor sync tests to parameterize tests. Allows tests to be used with various versions of WebDriver, e.g. ChromeDriver and geckodriver. (#152)

* Refactor tests to allow passing of WebDriver creation function. Allows same test to be used for Firefox and Chrome.

* Ran dartfmt over test dir.
diff --git a/test/chrome_json_wire_alert_test.dart b/test/chrome_json_wire_alert_test.dart
new file mode 100644
index 0000000..60e95ea
--- /dev/null
+++ b/test/chrome_json_wire_alert_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/alert.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_basic_sync_test.dart b/test/chrome_json_wire_basic_sync_test.dart
new file mode 100644
index 0000000..c815794
--- /dev/null
+++ b/test/chrome_json_wire_basic_sync_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/basic_sync.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_command_event_test.dart b/test/chrome_json_wire_command_event_test.dart
new file mode 100644
index 0000000..4d83d19
--- /dev/null
+++ b/test/chrome_json_wire_command_event_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/command_event.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_cookies_test.dart b/test/chrome_json_wire_cookies_test.dart
new file mode 100644
index 0000000..d86d63e
--- /dev/null
+++ b/test/chrome_json_wire_cookies_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/cookies.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_keyboard_test.dart b/test/chrome_json_wire_keyboard_test.dart
new file mode 100644
index 0000000..e9186b1
--- /dev/null
+++ b/test/chrome_json_wire_keyboard_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/keyboard.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_logs_test.dart b/test/chrome_json_wire_logs_test.dart
new file mode 100644
index 0000000..96372da
--- /dev/null
+++ b/test/chrome_json_wire_logs_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/logs.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_mouse_test.dart b/test/chrome_json_wire_mouse_test.dart
new file mode 100644
index 0000000..810f079
--- /dev/null
+++ b/test/chrome_json_wire_mouse_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/mouse.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_navigation_test.dart b/test/chrome_json_wire_navigation_test.dart
new file mode 100644
index 0000000..66c492f
--- /dev/null
+++ b/test/chrome_json_wire_navigation_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/navigation.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_target_locator_test.dart b/test/chrome_json_wire_target_locator_test.dart
new file mode 100644
index 0000000..87ed0a3
--- /dev/null
+++ b/test/chrome_json_wire_target_locator_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/target_locator.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_timeouts_test.dart b/test/chrome_json_wire_timeouts_test.dart
new file mode 100644
index 0000000..df75407
--- /dev/null
+++ b/test/chrome_json_wire_timeouts_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/timeouts.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_web_driver_test.dart b/test/chrome_json_wire_web_driver_test.dart
new file mode 100644
index 0000000..5d94dea
--- /dev/null
+++ b/test/chrome_json_wire_web_driver_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/web_driver.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_web_element_test.dart b/test/chrome_json_wire_web_element_test.dart
new file mode 100644
index 0000000..334f3cd
--- /dev/null
+++ b/test/chrome_json_wire_web_element_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/web_element.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/chrome_json_wire_window_test.dart b/test/chrome_json_wire_window_test.dart
new file mode 100644
index 0000000..1dba065
--- /dev/null
+++ b/test/chrome_json_wire_window_test.dart
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import 'sync/window.dart';
+import 'sync/sync_io_config.dart' as config;
+
+void main() {
+  runTests(config.createChromeTestDriver);
+}
diff --git a/test/alert_test.dart b/test/sync/alert.dart
similarity index 95%
rename from test/alert_test.dart
rename to test/sync/alert.dart
index d0bdc37..a07e3bb 100644
--- a/test/alert_test.dart
+++ b/test/sync/alert.dart
@@ -20,14 +20,14 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('Alert', () {
     WebDriver driver;
     WebElement button;
     WebElement output;
 
     setUp(() {
-      driver = config.createTestDriver();
+      driver = createTestDriver();
       driver.get(config.testPagePath);
       button = driver.findElement(const By.tagName('button'));
       output = driver.findElement(const By.id('settable'));
diff --git a/test/basic_sync_test.dart b/test/sync/basic_sync.dart
similarity index 92%
rename from test/basic_sync_test.dart
rename to test/sync/basic_sync.dart
index b2a4864..8dc82bd 100644
--- a/test/basic_sync_test.dart
+++ b/test/sync/basic_sync.dart
@@ -19,12 +19,12 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('Sync IO', () {
     WebDriver driver;
 
     setUp(() {
-      driver = config.createTestDriver();
+      driver = createTestDriver();
     });
 
     tearDown(() {
diff --git a/test/command_event_test.dart b/test/sync/command_event.dart
similarity index 95%
rename from test/command_event_test.dart
rename to test/sync/command_event.dart
index 1cec128..2f7613a 100644
--- a/test/command_event_test.dart
+++ b/test/sync/command_event.dart
@@ -21,14 +21,14 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('CommandEvent', () {
     WebDriver driver;
 
     var events = <WebDriverCommandEvent>[];
 
     setUp(() {
-      driver = config.createTestDriver();
+      driver = createTestDriver();
       driver.addEventListener(events.add);
       driver.get(config.testPagePath);
     });
diff --git a/test/cookies_test.dart b/test/sync/cookies.dart
similarity index 95%
rename from test/cookies_test.dart
rename to test/sync/cookies.dart
index f457494..43553a4 100644
--- a/test/cookies_test.dart
+++ b/test/sync/cookies.dart
@@ -20,12 +20,12 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('Cookies', () {
     WebDriver driver;
 
     setUp(() {
-      driver = config.createTestDriver();
+      driver = createTestDriver();
       driver.get('http://www.google.com/ncr');
     });
 
diff --git a/test/keyboard_test.dart b/test/sync/keyboard.dart
similarity index 95%
rename from test/keyboard_test.dart
rename to test/sync/keyboard.dart
index 9844856..ae57c5a 100644
--- a/test/keyboard_test.dart
+++ b/test/sync/keyboard.dart
@@ -22,7 +22,7 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('Keyboard', () {
     WebDriver driver;
     WebElement textInput;
@@ -35,7 +35,7 @@
         ctrlCmdKey = Keyboard.control;
       }
 
-      driver = config.createTestDriver();
+      driver = createTestDriver();
       driver.get(config.testPagePath);
       textInput = driver.findElement(const By.cssSelector('input[type=text]'));
       textInput.click();
diff --git a/test/logs_test.dart b/test/sync/logs.dart
similarity index 91%
rename from test/logs_test.dart
rename to test/sync/logs.dart
index c19190c..a7a37e4 100644
--- a/test/logs_test.dart
+++ b/test/sync/logs.dart
@@ -20,7 +20,7 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('Logs', () {
     WebDriver driver;
 
@@ -29,7 +29,7 @@
         Capabilities.loggingPrefs: {LogType.performance: LogLevel.info}
       };
 
-      driver = config.createTestDriver(additionalCapabilities: capabilities);
+      driver = createTestDriver(additionalCapabilities: capabilities);
       driver.get(config.testPagePath);
     });
 
diff --git a/test/mouse_test.dart b/test/sync/mouse.dart
similarity index 95%
rename from test/mouse_test.dart
rename to test/sync/mouse.dart
index 88af1ce..ead10b7 100644
--- a/test/mouse_test.dart
+++ b/test/sync/mouse.dart
@@ -20,13 +20,13 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('Mouse', () {
     WebDriver driver;
     WebElement button;
 
     setUp(() {
-      driver = config.createTestDriver();
+      driver = createTestDriver();
       driver.get(config.testPagePath);
       button = driver.findElement(const By.tagName('button'));
     });
diff --git a/test/navigation_test.dart b/test/sync/navigation.dart
similarity index 92%
rename from test/navigation_test.dart
rename to test/sync/navigation.dart
index c102b80..1d71b66 100644
--- a/test/navigation_test.dart
+++ b/test/sync/navigation.dart
@@ -20,12 +20,12 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('Navigation', () {
     WebDriver driver;
 
     setUp(() {
-      driver = config.createTestDriver();
+      driver = createTestDriver();
       driver.get(config.testPagePath);
     });
 
diff --git a/test/sync_io_config.dart b/test/sync/sync_io_config.dart
similarity index 86%
rename from test/sync_io_config.dart
rename to test/sync/sync_io_config.dart
index 07bd886..5a30721 100644
--- a/test/sync_io_config.dart
+++ b/test/sync/sync_io_config.dart
@@ -19,9 +19,13 @@
 import 'package:webdriver/sync_core.dart' show Capabilities, WebDriver;
 import 'package:webdriver/sync_io.dart' show createDriver;
 
-export 'test_util.dart';
+export '../test_util.dart';
 
-WebDriver createTestDriver({Map<String, dynamic> additionalCapabilities}) {
+typedef WebDriver createTestDriver(
+    {Map<String, dynamic> additionalCapabilities});
+
+WebDriver createChromeTestDriver(
+    {Map<String, dynamic> additionalCapabilities}) {
   var capabilities = Capabilities.chrome;
   Map env = Platform.environment;
 
diff --git a/test/target_locator_test.dart b/test/sync/target_locator.dart
similarity index 94%
rename from test/target_locator_test.dart
rename to test/sync/target_locator.dart
index 35c86ad..65e36b4 100644
--- a/test/target_locator_test.dart
+++ b/test/sync/target_locator.dart
@@ -24,13 +24,13 @@
  * Tests for switchTo.frame(). switchTo.window() and switchTo.alert are tested
  * in other classes.
  */
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('TargetLocator', () {
     WebDriver driver;
     WebElement frame;
 
     setUp(() {
-      driver = config.createTestDriver();
+      driver = createTestDriver();
       driver.get(config.testPagePath);
       frame = driver.findElement(const By.name('frame'));
     });
diff --git a/test/timeouts_test.dart b/test/sync/timeouts.dart
similarity index 92%
rename from test/timeouts_test.dart
rename to test/sync/timeouts.dart
index 280cae5..95c5ce4 100644
--- a/test/timeouts_test.dart
+++ b/test/sync/timeouts.dart
@@ -20,12 +20,12 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('TimeOuts', () {
     WebDriver driver;
 
     setUp(() {
-      driver = config.createTestDriver();
+      driver = createTestDriver();
     });
 
     tearDown(() {
diff --git a/test/web_driver_test.dart b/test/sync/web_driver.dart
similarity index 97%
rename from test/web_driver_test.dart
rename to test/sync/web_driver.dart
index 3569bf6..4c244b4 100644
--- a/test/web_driver_test.dart
+++ b/test/sync/web_driver.dart
@@ -20,11 +20,11 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('WebDriver', () {
     group('create', () {
       test('default', () {
-        WebDriver driver = config.createTestDriver();
+        WebDriver driver = createTestDriver();
         driver.get(config.testPagePath);
         var element = driver.findElement(const By.tagName('button'));
         expect(element.name, 'button');
@@ -36,7 +36,7 @@
       WebDriver driver;
 
       setUp(() {
-        driver = config.createTestDriver();
+        driver = createTestDriver();
         driver.get(config.testPagePath);
       });
 
diff --git a/test/web_element_test.dart b/test/sync/web_element.dart
similarity index 97%
rename from test/web_element_test.dart
rename to test/sync/web_element.dart
index bfb26d0..0e78dab 100644
--- a/test/web_element_test.dart
+++ b/test/sync/web_element.dart
@@ -20,7 +20,7 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('WebElement', () {
     WebDriver driver;
     WebElement table;
@@ -32,7 +32,7 @@
     WebElement invisible;
 
     setUp(() {
-      driver = config.createTestDriver();
+      driver = createTestDriver();
       driver.get(config.testPagePath);
       table = driver.findElement(const By.tagName('table'));
       button = driver.findElement(const By.tagName('button'));
diff --git a/test/window_test.dart b/test/sync/window.dart
similarity index 95%
rename from test/window_test.dart
rename to test/sync/window.dart
index 3353748..31abfa5 100644
--- a/test/window_test.dart
+++ b/test/sync/window.dart
@@ -22,12 +22,12 @@
 
 import 'sync_io_config.dart' as config;
 
-void main() {
+void runTests(config.createTestDriver createTestDriver) {
   group('Window', () {
     WebDriver driver;
 
     setUp(() {
-      driver = config.createTestDriver();
+      driver = createTestDriver();
     });
 
     tearDown(() {