Merge pull request #34 from DrMarcII/master

Fixes for window_test
diff --git a/lib/src/common.dart b/lib/src/common.dart
index bfce556..4b5ef82 100644
--- a/lib/src/common.dart
+++ b/lib/src/common.dart
@@ -21,6 +21,13 @@
   Size.fromJson(Map json) : this(json['height'], json['width']);
 
   Map<String, num> toJson() => {'height': height, 'width': width};
+
+  @override
+  int get hashCode => height.hashCode * 3 + width.hashCode;
+
+  @override
+  bool operator ==(other) =>
+      other is Size && other.height == this.height && other.width == this.width;
 }
 
 class Point {
@@ -32,6 +39,13 @@
   Point.fromJson(Map json) : this(json['x'], json['y']);
 
   Map<String, num> toJson() => {'x': x, 'y': y};
+
+  @override
+  int get hashCode => x.hashCode * 3 + x.hashCode;
+
+  @override
+  bool operator ==(other) =>
+      other is Point && other.x == this.x && other.x == this.x;
 }
 
 abstract class SearchContext {
diff --git a/test/src/options_test.dart b/test/src/options_test.dart
index d6aac52..4c09e9c 100644
--- a/test/src/options_test.dart
+++ b/test/src/options_test.dart
@@ -19,7 +19,7 @@
       await driver.cookies.add(new Cookie('mycookie', 'myvalue'));
 
       bool found = false;
-      for (var cookie in driver.cookies.all) {
+      await for (var cookie in driver.cookies.all) {
         if (cookie.name == 'mycookie') {
           found = true;
           expect(cookie.value, 'myvalue');
@@ -34,7 +34,7 @@
       await driver.cookies.add(new Cookie('mycookie', 'myvalue',
           path: '/', domain: '.google.com', secure: false, expiry: date));
       bool found = false;
-      for (var cookie in driver.cookies.all) {
+      await for (var cookie in driver.cookies.all) {
         if (cookie.name == 'mycookie') {
           found = true;
           expect(cookie.value, 'myvalue');
@@ -49,7 +49,7 @@
       await driver.cookies.add(new Cookie('mycookie', 'myvalue'));
       await driver.cookies.delete('mycookie');
       bool found = false;
-      for (var cookie in driver.cookies.all) {
+      await for (var cookie in driver.cookies.all) {
         if (cookie.name == 'mycookie') {
           found = true;
           break;
diff --git a/test/src/web_driver_test.dart b/test/src/web_driver_test.dart
index 4cc14da..4b78076 100644
--- a/test/src/web_driver_test.dart
+++ b/test/src/web_driver_test.dart
@@ -111,7 +111,7 @@
         Window next;
         await (await driver.findElement(new By.partialLinkText('Open copy')))
             .click();
-        for (Window window in driver.windows) {
+        await for (Window window in driver.windows) {
           if (window != orig) {
             next = window;
             await driver.switchTo.window(window);
diff --git a/test/src/window_test.dart b/test/src/window_test.dart
index 494c378..03dcaf4 100644
--- a/test/src/window_test.dart
+++ b/test/src/window_test.dart
@@ -2,10 +2,9 @@
 
 import 'package:unittest/unittest.dart';
 import 'package:webdriver/webdriver.dart';
-import '../test_util.dart';
 
 void main() {
-  solo_group('Window', () {
+  group('Window', () {
     WebDriver driver;
 
     setUp(() async {
@@ -17,31 +16,30 @@
 
     test('size', () async {
       var window = await driver.window;
-      await window.setSize(new Size(400, 600));
-      var size = await window.size;
-      expect(size, isSize);
-      expect(size.height, 400);
-      expect(size.width, 600);
+      var size = const Size(400, 600);
+      await window.setSize(size);
+      expect(await window.size, size);
     });
 
     test('location', () async {
       var window = await driver.window;
-
-      await window.setLocation(new Point(10, 20));
-      var point = await window.location;
-      expect(point, isPoint);
-      expect(point.x, 10);
-      expect(point.y, 20);
+      var position = const Point(100, 200);
+      await window.setLocation(position);
+      expect(await window.location, position);
     });
 
-    // fails in some cases with multiple monitors
+    // May not work on some OS/browser combinations (notably Mac OS X).
     test('maximize', () async {
       var window = await driver.window;
+      await window.setSize(const Size(200, 300));
+      await window.setLocation(const Point(100, 200));
       await window.maximize();
-      var point = await window.location;
-      expect(point, isPoint);
-      expect(point.x, 0);
-      expect(point.y, 0);
+      var location = await window.location;
+      var size = await window.size;
+      expect(location.x, lessThan(100));
+      expect(location.y, lessThan(200));
+      expect(size.height, greaterThan(200));
+      expect(size.width, greaterThan(300));
     });
   });
 }