1#!/usr/bin/python 2# Copyright 2013 The Chromium Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6"""Host-driven Java tests which exercise sync functionality.""" 7 8from pylib import constants 9from pylib.host_driven import test_case 10from pylib.host_driven import test_server 11from pylib.host_driven import tests_annotations 12 13 14class SyncTest(test_case.HostDrivenTestCase): 15 """Host-driven Java tests which exercise sync functionality.""" 16 17 def __init__(self, *args, **kwargs): 18 super(SyncTest, self).__init__(*args, **kwargs) 19 self.test_server = None 20 self.additional_flags = [] 21 22 def SetUp(self, device, shard_index, push_deps, cleanup_test_files): 23 self.test_server = test_server.TestServer( 24 shard_index, 25 constants.TEST_SYNC_SERVER_PORT, 26 test_server.TEST_SYNC_SERVER_PATH) 27 # These ought not to change in the middle of a test for obvious reasons. 28 self.additional_flags = [ 29 '--sync-url=http://%s:%d/chromiumsync' % 30 (self.test_server.host, self.test_server.port)] 31 super(SyncTest, self).SetUp(device, shard_index, push_deps, 32 cleanup_test_files, 33 [self.test_server.port]) 34 35 def TearDown(self): 36 super(SyncTest, self).TearDown() 37 self.test_server.TearDown() 38 39 def _RunSyncTests(self, test_names): 40 full_names = [] 41 for test_name in test_names: 42 full_names.append('SyncTest.' + test_name) 43 return self._RunJavaTestFilters(full_names, self.additional_flags) 44 45 @tests_annotations.Feature(['Sync']) 46 @tests_annotations.EnormousTest 47 def testGetAboutSyncInfoYieldsValidData(self): 48 java_tests = ['testGetAboutSyncInfoYieldsValidData'] 49 return self._RunSyncTests(java_tests) 50 51 # Disabled for http://crbug.com/309997 52 # @tests_annotations.Feature(['Sync']) 53 # @tests_annotations.EnormousTest 54 @tests_annotations.DisabledTest 55 def testAboutSyncPageDisplaysCurrentSyncStatus(self): 56 java_tests = ['testAboutSyncPageDisplaysCurrentSyncStatus'] 57 return self._RunSyncTests(java_tests) 58 59 # Disabled for http://crbug.com/311091 60 # @tests_annotations.Feature(['Sync']) 61 # @tests_annotations.EnormousTest 62 @tests_annotations.DisabledTest 63 def testDisableAndEnableSync(self): 64 java_tests = ['testDisableAndEnableSync'] 65 return self._RunSyncTests(java_tests) 66