Refactors Navigation into JSON wire and W3C specs. Adds test for navigation against W3C spec/Firefox.  (#169)

* Adds W3c navigation test.

* Refactor navigation into JSON wire and W3c spec. Make small changes to JSON wire spec to create W3C spec.

* Dartfmt.
diff --git a/lib/src/sync/common_spec/navigation.dart b/lib/src/sync/json_wire_spec/navigation.dart
similarity index 82%
rename from lib/src/sync/common_spec/navigation.dart
rename to lib/src/sync/json_wire_spec/navigation.dart
index 5ec800c..978b569 100644
--- a/lib/src/sync/common_spec/navigation.dart
+++ b/lib/src/sync/json_wire_spec/navigation.dart
@@ -13,14 +13,15 @@
 // limitations under the License.
 
 import '../common.dart';
+import '../navigation.dart';
 import '../web_driver.dart';
 
 /// Browser navigation actions.
-class Navigation {
+class JsonWireNavigation implements Navigation {
   final WebDriver _driver;
   final Resolver _resolver;
 
-  Navigation(this._driver) : _resolver = new Resolver(_driver, '');
+  JsonWireNavigation(this._driver) : _resolver = new Resolver(_driver, '');
 
   ///  Navigate forwards in the browser history, if possible.
   void forward() {
@@ -44,5 +45,6 @@
   int get hashCode => _driver.hashCode;
 
   @override
-  bool operator ==(other) => other is Navigation && other._driver == _driver;
+  bool operator ==(other) =>
+      other is JsonWireNavigation && other._driver == _driver;
 }
diff --git a/lib/src/sync/json_wire_spec/web_driver.dart b/lib/src/sync/json_wire_spec/web_driver.dart
index b1cd59d..5202fe0 100644
--- a/lib/src/sync/json_wire_spec/web_driver.dart
+++ b/lib/src/sync/json_wire_spec/web_driver.dart
@@ -19,17 +19,18 @@
 import 'keyboard.dart';
 import 'logs.dart';
 import 'mouse.dart';
+import 'navigation.dart';
 import 'target_locator.dart';
 import 'timeouts.dart';
 import 'web_element.dart';
 import 'window.dart';
 
-import '../common_spec/navigation.dart';
 import '../common_spec/cookies.dart';
 
 import '../command_event.dart';
 import '../command_processor.dart';
 import '../common.dart';
+import '../navigation.dart';
 import '../target_locator.dart';
 import '../timeouts.dart';
 import '../web_driver.dart';
@@ -133,7 +134,7 @@
   TargetLocator get switchTo => new JsonWireTargetLocator(this);
 
   @override
-  Navigation get navigate => new Navigation(this);
+  Navigation get navigate => new JsonWireNavigation(this);
 
   @override
   Cookies get cookies => new Cookies(this);
diff --git a/lib/src/sync/navigation.dart b/lib/src/sync/navigation.dart
new file mode 100644
index 0000000..49ce65c
--- /dev/null
+++ b/lib/src/sync/navigation.dart
@@ -0,0 +1,25 @@
+// 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.
+
+/// Browser navigation actions.
+abstract class Navigation {
+  ///  Navigate forwards in the browser history, if possible.
+  void forward();
+
+  /// Navigate backwards in the browser history, if possible.
+  void back();
+
+  /// Refresh the current page.
+  void refresh();
+}
diff --git a/lib/src/sync/common_spec/navigation.dart b/lib/src/sync/w3c_spec/navigation.dart
similarity index 76%
copy from lib/src/sync/common_spec/navigation.dart
copy to lib/src/sync/w3c_spec/navigation.dart
index 5ec800c..b44b86c 100644
--- a/lib/src/sync/common_spec/navigation.dart
+++ b/lib/src/sync/w3c_spec/navigation.dart
@@ -13,28 +13,28 @@
 // limitations under the License.
 
 import '../common.dart';
+import '../navigation.dart';
 import '../web_driver.dart';
 
-/// Browser navigation actions.
-class Navigation {
+class W3cNavigation implements Navigation {
   final WebDriver _driver;
   final Resolver _resolver;
 
-  Navigation(this._driver) : _resolver = new Resolver(_driver, '');
+  W3cNavigation(this._driver) : _resolver = new Resolver(_driver, '');
 
   ///  Navigate forwards in the browser history, if possible.
   void forward() {
-    _resolver.post('forward');
+    _resolver.post('forward', {});
   }
 
   /// Navigate backwards in the browser history, if possible.
   void back() {
-    _resolver.post('back');
+    _resolver.post('back', {});
   }
 
   /// Refresh the current page.
   void refresh() {
-    _resolver.post('refresh');
+    _resolver.post('refresh', {});
   }
 
   @override
@@ -44,5 +44,5 @@
   int get hashCode => _driver.hashCode;
 
   @override
-  bool operator ==(other) => other is Navigation && other._driver == _driver;
+  bool operator ==(other) => other is W3cNavigation && other._driver == _driver;
 }
diff --git a/lib/src/sync/w3c_spec/web_driver.dart b/lib/src/sync/w3c_spec/web_driver.dart
index fba2ae5..0e2e18e 100644
--- a/lib/src/sync/w3c_spec/web_driver.dart
+++ b/lib/src/sync/w3c_spec/web_driver.dart
@@ -16,12 +16,12 @@
 import 'package:stack_trace/stack_trace.dart' show Chain;
 
 import 'element_finder.dart';
+import 'navigation.dart';
 import 'target_locator.dart';
 import 'timeouts.dart';
 import 'web_element.dart';
 import 'window.dart';
 
-import '../common_spec/navigation.dart';
 import '../common_spec/cookies.dart';
 
 // We don't implement this, but we need the types to define the API.
@@ -32,6 +32,7 @@
 import '../command_event.dart';
 import '../command_processor.dart';
 import '../common.dart';
+import '../navigation.dart';
 import '../target_locator.dart';
 import '../timeouts.dart';
 import '../web_driver.dart';
@@ -117,7 +118,7 @@
   TargetLocator get switchTo => new W3cTargetLocator(this);
 
   @override
-  Navigation get navigate => new Navigation(this);
+  Navigation get navigate => new W3cNavigation(this);
 
   @override
   Cookies get cookies => new Cookies(this);
diff --git a/lib/src/sync/web_driver.dart b/lib/src/sync/web_driver.dart
index 51572e8..0f5dbd9 100644
--- a/lib/src/sync/web_driver.dart
+++ b/lib/src/sync/web_driver.dart
@@ -15,12 +15,12 @@
 import 'command_event.dart';
 import 'common.dart';
 import 'exception.dart';
+import 'navigation.dart';
 import 'target_locator.dart';
 import 'timeouts.dart';
 import 'web_element.dart';
 import 'window.dart';
 
-import 'common_spec/navigation.dart';
 import 'common_spec/cookies.dart';
 
 import 'json_wire_spec/mouse.dart';
diff --git a/lib/sync_core.dart b/lib/sync_core.dart
index e6e5645..45dd702 100644
--- a/lib/sync_core.dart
+++ b/lib/sync_core.dart
@@ -31,7 +31,7 @@
 export 'package:webdriver/src/sync/command_processor.dart';
 export 'package:webdriver/src/sync/common.dart';
 export 'package:webdriver/src/sync/common_spec/cookies.dart';
-export 'package:webdriver/src/sync/common_spec/navigation.dart';
+export 'package:webdriver/src/sync/navigation.dart';
 export 'package:webdriver/src/sync/exception.dart';
 export 'package:webdriver/src/sync/json_wire_spec/keyboard.dart';
 export 'package:webdriver/src/sync/json_wire_spec/logs.dart';
diff --git a/test/firefox_navigation_test.dart b/test/firefox_navigation_test.dart
new file mode 100644
index 0000000..ce573ee
--- /dev/null
+++ b/test/firefox_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.createFirefoxTestDriver);
+}
diff --git a/test/sync/navigation.dart b/test/sync/navigation.dart
index ce0741c..badafa4 100644
--- a/test/sync/navigation.dart
+++ b/test/sync/navigation.dart
@@ -41,10 +41,10 @@
       driver.navigate.refresh();
       try {
         element.name;
-      } on StaleElementReferenceException {
+      } on Exception {
         return true;
       }
-      return 'expected StaleElementReferenceException';
+      return 'expected Exception';
     });
   }, timeout: new Timeout(new Duration(minutes: 2)));
 }