Home | History | Annotate | Download | only in buffet_RestartWhenRegistered
      1 # Copyright 2015 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 from autotest_lib.client.bin import test
      6 from autotest_lib.client.common_lib.cros.tendo import buffet_tester
      7 
      8 class buffet_RestartWhenRegistered(test.test):
      9     """Test that buffet keeps registration details across restarts."""
     10     version = 1
     11 
     12     def initialize(self):
     13         self._helper = buffet_tester.BuffetTester()
     14 
     15 
     16     def run_once(self):
     17         # Erase all buffet state and restart it pointing to our fake
     18         # server, register with the cloud and check we can poll for
     19         # commands.
     20         self._helper.restart_buffet(reset_state=True)
     21         self._helper.check_buffet_status_is(buffet_tester.STATUS_UNCONFIGURED)
     22         device_id = self._helper.register_with_server()
     23         self._helper.check_buffet_is_polling(device_id)
     24 
     25         # Now restart buffet, while maintaining our built up state.
     26         # Confirm that when we start up again, we resume polling for
     27         # commands and the device_id is the same.
     28         self._helper.restart_buffet(reset_state=False)
     29         self._helper.check_buffet_is_polling(device_id)
     30         self._helper.check_buffet_status_is(
     31                 buffet_tester.STATUS_CONNECTED, expected_device_id=device_id)
     32 
     33 
     34     def cleanup(self):
     35         self._helper.close()
     36