OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
| 10 import time |
10 | 11 |
11 import pyauto_functional | 12 import pyauto_functional |
12 import pyauto | 13 import pyauto |
13 | 14 |
14 sys.path.append('/usr/local') # To make autotest libs importable. | 15 sys.path.append('/usr/local') # To make autotest libs importable. |
15 from autotest.cros import cros_ui | 16 from autotest.cros import cros_ui |
16 from autotest.cros import cryptohome | 17 from autotest.cros import cryptohome |
17 | 18 |
18 | 19 |
19 class AccessibilityTest(pyauto.PyUITest): | 20 class AccessibilityTest(pyauto.PyUITest): |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 """Test that Guest user login is possible when Accessibility is on.""" | 68 """Test that Guest user login is possible when Accessibility is on.""" |
68 self._EnableSpokenFeedback() | 69 self._EnableSpokenFeedback() |
69 self.LoginAsGuest() | 70 self.LoginAsGuest() |
70 login_info = self.GetLoginInfo() | 71 login_info = self.GetLoginInfo() |
71 self.assertTrue(login_info['is_logged_in'], msg='Not logged in at all.') | 72 self.assertTrue(login_info['is_logged_in'], msg='Not logged in at all.') |
72 self.assertTrue(login_info['is_guest'], msg='Not logged in as guest.') | 73 self.assertTrue(login_info['is_guest'], msg='Not logged in as guest.') |
73 url = self.GetFileURLForDataPath('title1.html') | 74 url = self.GetFileURLForDataPath('title1.html') |
74 self.NavigateToURL(url) | 75 self.NavigateToURL(url) |
75 self.assertEqual(1, self.FindInPage('title')['match_count'], | 76 self.assertEqual(1, self.FindInPage('title')['match_count'], |
76 msg='Failed to load the page or find the page contents.') | 77 msg='Failed to load the page or find the page contents.') |
| 78 # crbug.com/129218: adding a volume change functionality to automate this |
| 79 # issue. Please note that we don't verify any functionality here. |
| 80 default_volume = self.GetVolumeInfo() |
| 81 for test_volume in (50.00, 77.00, 85.00, 20.00): |
| 82 self.SetVolume(test_volume) |
| 83 time.sleep(1) |
| 84 self.SetVolume(default_volume.get('volume')) |
77 | 85 |
78 def testAccessibilityBeforeLogin(self): | 86 def testAccessibilityBeforeLogin(self): |
79 """Test Accessibility before login.""" | 87 """Test Accessibility before login.""" |
80 self._LoginWithSpokenFeedback() | 88 self._LoginWithSpokenFeedback() |
81 self.Logout() | 89 self.Logout() |
82 self.assertFalse(self.GetLoginInfo()['is_logged_in'], | 90 self.assertFalse(self.GetLoginInfo()['is_logged_in'], |
83 msg='Still logged in when we should be logged out.') | 91 msg='Still logged in when we should be logged out.') |
84 self.assertTrue(self.IsSpokenFeedbackEnabled(), | 92 self.assertTrue(self.IsSpokenFeedbackEnabled(), |
85 msg='Spoken feedback accessibility mode disabled after loggin out.') | 93 msg='Spoken feedback accessibility mode disabled after loggin out.') |
86 | 94 |
87 def testAccessibilityAfterLogin(self): | 95 def testAccessibilityAfterLogin(self): |
88 """Test Accessibility after login.""" | 96 """Test Accessibility after login.""" |
89 self._Login() | 97 self._Login() |
90 self._EnableSpokenFeedback() | 98 self._EnableSpokenFeedback() |
91 | 99 |
92 def testPagePerformance(self): | 100 def testPagePerformance(self): |
93 """Test Chrome works fine when Accessibility is on.""" | 101 """Test Chrome works fine when Accessibility is on.""" |
94 self._LoginWithSpokenFeedback() | 102 self._LoginWithSpokenFeedback() |
95 # Verify that opened tab page behaves normally when Spoken Feedback is | 103 # Verify that opened tab page behaves normally when Spoken Feedback is |
96 # enabled. crosbug.com/26731 | 104 # enabled. crosbug.com/26731 |
97 url = self.GetFileURLForDataPath(self.find_test_data_dir, 'largepage.html') | 105 url = self.GetFileURLForDataPath(self.find_test_data_dir, 'largepage.html') |
98 self.NavigateToURL(url) | 106 self.NavigateToURL(url) |
99 self.assertEqual(373, self.FindInPage('daughter of Prince')['match_count'], | 107 self.assertEqual(373, self.FindInPage('daughter of Prince')['match_count'], |
100 msg='Failed to load the page or find the page contents.') | 108 msg='Failed to load the page or find the page contents.') |
101 | 109 |
102 | 110 |
103 if __name__ == '__main__': | 111 if __name__ == '__main__': |
104 pyauto_functional.Main() | 112 pyauto_functional.Main() |
OLD | NEW |