Fix broken tests.

Now that SyncGroupPrefixes are classes rather than strings, we need a
helper method to compare them for equality.

Can't wait to get these tests running on jenkins...

Change-Id: I903df7c15bd370141484d2e94ba36b2e8814f85a
diff --git a/dart/lib/syncbase_client.dart b/dart/lib/syncbase_client.dart
index c471e05..3f01930 100644
--- a/dart/lib/syncbase_client.dart
+++ b/dart/lib/syncbase_client.dart
@@ -104,7 +104,7 @@
       {String description: '',
       bool isPrivate: false,
       mojom.Perms perms,
-      List<String> prefixes,
+      List<mojom.SyncGroupPrefix> prefixes,
       List<String> mountTables}) {
     if (prefixes == null) {
       throw new ArgumentError('prefixes must be specified');
diff --git a/dart/test/integration/syncbase_syncgroup_test.dart b/dart/test/integration/syncbase_syncgroup_test.dart
index 2bbebc5..e1fc872 100644
--- a/dart/test/integration/syncbase_syncgroup_test.dart
+++ b/dart/test/integration/syncbase_syncgroup_test.dart
@@ -7,7 +7,7 @@
 import 'package:test/test.dart';
 
 import 'package:ether/syncbase_client.dart'
-    show SyncbaseClient, SyncgroupPrefix;
+    show SyncbaseClient, SyncgroupPrefix, SyncGroupSpec;
 
 import './utils.dart' as utils;
 
@@ -22,6 +22,41 @@
   return res;
 }
 
+// NOTE(nlacasse): It would be nice if we could override the == operator on
+// SyncgroupSpec so that checking for equality would "just work" without
+// needing this helper method.  Unfortunately those SyncgroupSpec is generated
+// from the mojom file, so there's no way to change its functionality without
+// wrapping, which I'd like to avoid.
+bool specsAreEqual(SyncGroupSpec s1, SyncGroupSpec s2) {
+  if (s1.description != s2.description) {
+    return false;
+  }
+  if (s1.prefixes.length != s2.prefixes.length) {
+    return false;
+  }
+
+  // Sort prefixes by tableName then rowPrefix.
+  int comparePrefixes(p1, p2) {
+    if (p1.tableName != p2.tableName) {
+      return p1.tableName.compareTo(p2.tableName);
+    }
+    return p1.rowPrefix.compareTo(p2.rowPrefix);
+  }
+
+  s1.prefixes.sort(comparePrefixes);
+  s2.prefixes.sort(comparePrefixes);
+
+  for (var i = 0; i < s1.prefixes.length; i++) {
+    if (s1.prefixes[i].tableName != s2.prefixes[i].tableName) {
+      return false;
+    }
+    if (s1.prefixes[i].rowPrefix != s2.prefixes[i].rowPrefix) {
+      return false;
+    }
+  }
+  return true;
+}
+
 runSyncgroupTests(SyncbaseClient c) {
   // TODO(nlacasse): Where does this magic number 8 come from? It's in
   // syncgroup_test.go.
@@ -130,8 +165,7 @@
     await sg.create(spec, myInfo);
 
     var gotSpec = await sg.getSpec();
-    expect(gotSpec.description, equals(spec.description));
-    expect(gotSpec.prefixes, equals(spec.prefixes));
+    expect(specsAreEqual(gotSpec, spec), isTrue);
 
     var newSpec = SyncbaseClient.syncgroupSpec(
         description: 'a totally new spec ${sgName}',
@@ -140,7 +174,6 @@
     await sg.setSpec(newSpec, '');
 
     var gotSpec2 = await sg.getSpec();
-    expect(gotSpec2.description, equals(newSpec.description));
-    expect(gotSpec2.prefixes, equals(newSpec.prefixes));
+    expect(specsAreEqual(gotSpec2, newSpec), isTrue);
   });
 }