Deprecate serve_only for archive_dir.

Also change when the devserver will attempt to generate a payload, and
when it will attempt to generate a payload from the latest local build.

Previously, generation was attempted when no --image or --payload was
specified, and if archive_dir's serve_only mode was off.

Since serve_only is gone, we now just check that we're within chroot
before attempting to generate a payload.

Before attempting to generate a payload from the most recent local
build, we check that the directory specified by the label (if provided)
doesn't contain an update file.

BUG=chromium:261775
TEST=unittests updated
cbuildbot --remote mario-paladin

Change-Id: If094db197005836d9fcad5fb63ffcb8470be3706
Reviewed-on: https://gerrit.chromium.org/gerrit/63363
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Joy Chen <joychen@chromium.org>
Tested-by: Joy Chen <joychen@chromium.org>
Commit-Queue: Joy Chen <joychen@chromium.org>
diff --git a/autoupdate_unittest.py b/autoupdate_unittest.py
index f86748e..decd3f5 100755
--- a/autoupdate_unittest.py
+++ b/autoupdate_unittest.py
@@ -18,6 +18,7 @@
 import autoupdate
 import autoupdate_lib
 import common_util
+import devserver_constants as constants
 
 
 _TEST_REQUEST = """
@@ -120,7 +121,7 @@
     test_data = _TEST_REQUEST % self.test_dict
 
     # Generate a fake payload.
-    update_gz = os.path.join(self.static_image_dir, autoupdate.UPDATE_FILE)
+    update_gz = os.path.join(self.static_image_dir, constants.UPDATE_FILE)
     with open(update_gz, 'w') as fh:
       fh.write('')
 
@@ -152,7 +153,7 @@
     test_data = _TEST_REQUEST % self.test_dict
 
     # Generate a fake payload.
-    update_gz = os.path.join(self.static_image_dir, autoupdate.UPDATE_FILE)
+    update_gz = os.path.join(self.static_image_dir, constants.UPDATE_FILE)
     with open(update_gz, 'w') as fh:
       fh.write('')
 
@@ -221,7 +222,7 @@
         test_label)
 
   def testHandleUpdatePingWithSetUpdate(self):
-    self.mox.StubOutWithMock(autoupdate.Autoupdate, 'GenerateLatestUpdateImage')
+    """If update is set, it should use the update found in that directory."""
     self.mox.StubOutWithMock(autoupdate.Autoupdate, '_StoreMetadataToFile')
     au_mock = self._DummyAutoupdateConstructor()
 
@@ -230,12 +231,9 @@
     new_image_dir = os.path.join(self.static_image_dir, test_label)
     new_url = self.url.replace('update.gz', test_label + '/update.gz')
 
-    au_mock.GenerateLatestUpdateImage(
-        self.test_board, 'ForcedUpdate', new_image_dir).AndReturn(None)
-
     # Generate a fake payload.
     os.makedirs(new_image_dir)
-    update_gz = os.path.join(new_image_dir, autoupdate.UPDATE_FILE)
+    update_gz = os.path.join(new_image_dir, constants.UPDATE_FILE)
     with open(update_gz, 'w') as fh:
       fh.write('')