Hello aa,

I'd like you to do a code review.  Please execute
        g4 diff -c 8744075

or point your web browser to
        http://mondrian/8744075

to review the following code:

Change 8744075 by [EMAIL PROTECTED] on 2008/10/27 20:01:21 *pending*

        Add an automated drag-and-drop unit test.
        
        PRESUBMIT=passed
        R=aa
        [EMAIL PROTECTED]
        DELTA=70  (58 added, 12 deleted, 0 changed)
        OCL=8744075

Affected files ...

... 
//depot/googleclient/gears/opensource/gears/test/manual/drag_and_drop.html#4 
edit
... //depot/googleclient/gears/opensource/gears/test/testcases/config.js#34 edit
... 
//depot/googleclient/gears/opensource/gears/test/testcases/desktop_tests.js#1 
add

70 delta lines: 58 added, 12 deleted, 0 changed

Also consider running:
        g4 lint -c 8744075

which verifies that the changelist doesn't introduce new style violations.

If you can't do the review, please let me know as soon as possible.  During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately.  Visit
http://www/eng/code_review.html for more information.

This is a semiautomated message from "g4 mail".  Complaints or suggestions?
Mail [EMAIL PROTECTED]
Change 8744075 by [EMAIL PROTECTED] on 2008/10/27 20:01:21 *pending*

        Add an automated drag-and-drop unit test.

Affected files ...

... 
//depot/googleclient/gears/opensource/gears/test/manual/drag_and_drop.html#4 
edit
... //depot/googleclient/gears/opensource/gears/test/testcases/config.js#34 edit
... 
//depot/googleclient/gears/opensource/gears/test/testcases/desktop_tests.js#1 
add

==== 
//depot/googleclient/gears/opensource/gears/test/manual/drag_and_drop.html#4 - 
/home/nigeltao/srcgears2/googleclient/gears/opensource/gears/test/manual/drag_and_drop.html
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/test/manual/drag_and_drop.html  
2008-10-23 21:02:35.000000000 +1100
+++ googleclient/gears/opensource/gears/test/manual/drag_and_drop.html  
2008-10-27 19:59:35.000000000 +1100
@@ -73,18 +73,6 @@
   }
 }
 toggleEnabledDisabled();
-
-// TODO(nigeltao): Move this into a unit test (as opposed to a manual test).
-var dropZoneIdIsGood = false;
-try {
-  if (dropZone.id == 'dropZone') {
-    dropZoneIdIsGood = true;
-  }
-} catch (ex) {
-}
-if (!dropZoneIdIsGood) {
-  alert('dropZone.id is broken.');
-}
 </script>
 </body>
 </html>
==== //depot/googleclient/gears/opensource/gears/test/testcases/config.js#34 - 
/home/nigeltao/srcgears2/googleclient/gears/opensource/gears/test/testcases/config.js
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/test/testcases/config.js        
2008-10-13 12:43:34.000000000 +1100
+++ googleclient/gears/opensource/gears/test/testcases/config.js        
2008-10-27 20:03:41.000000000 +1100
@@ -100,6 +100,13 @@
   suites.push(database2Suite);
 }
 
+if (!isOfficial && (isIE || isFirefox)) {
+  var desktopSuite = new TestSuite('Desktop');
+  desktopSuite.addFile('../testcases/desktop_tests.js', 
+                       {useWorker: false, useIFrame: true});
+  suites.push(desktopSuite);
+}
+
 if (!isOfficial) {
   var dummySuite = new TestSuite('Dummy');
   dummySuite.addFile('../testcases/dummy_tests.js',
==== 
//depot/googleclient/gears/opensource/gears/test/testcases/desktop_tests.js#1 - 
/home/nigeltao/srcgears2/googleclient/gears/opensource/gears/test/testcases/desktop_tests.js
 ====
# action=add type=text
--- /dev/null   1970-01-01 10:00:00.000000000 +1000
+++ googleclient/gears/opensource/gears/test/testcases/desktop_tests.js 
2008-10-27 20:00:21.000000000 +1100
@@ -0,0 +1,51 @@
+// Copyright 2008, Google Inc.
+//
+// Redistribution and use in source and binary forms, with or without 
+// modification, are permitted provided that the following conditions are met:
+//
+//  1. Redistributions of source code must retain the above copyright notice, 
+//     this list of conditions and the following disclaimer.
+//  2. Redistributions in binary form must reproduce the above copyright 
notice,
+//     this list of conditions and the following disclaimer in the 
documentation
+//     and/or other materials provided with the distribution.
+//  3. Neither the name of Google Inc. nor the names of its contributors may be
+//     used to endorse or promote products derived from this software without
+//     specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF  
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+var desktop = google.gears.factory.create('beta.desktop');
+
+function testRegisterDropTargetDoesntStripExistingAttributes() {
+  // First, make sure we start with a clean slate, i.e. there is no DIV with
+  // id 'dropTargetId'.
+  assertEqual(null, document.getElementById('dropTargetId'));
+
+  // Now, we create such a DIV, and assert that we can see it.
+  var div = document.createElement('div');
+  div.id = 'dropTargetId';
+  div.appendChild(document.createTextNode('Lorem ipsum.')); 
+  document.body.appendChild(div); 
+  assertEqual('dropTargetId', div.id);
+  assertNotEqual(null, document.getElementById('dropTargetId'));
+
+  // Finally, we registerDropTarget that DIV, and assert that we can still
+  // see that DIV.
+  desktop.registerDropTarget(div, {
+    'ondragenter': function(context) {},
+    'ondragover': function(context) {},
+    'ondragleave': function(context) {},
+    'ondrop': function(context) {}
+  });
+  assertEqual('dropTargetId', div.id);
+  assertNotEqual(null, document.getElementById('dropTargetId'));
+}

Reply via email to