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 os | 6 import os |
7 import re | 7 import re |
8 | 8 |
9 import pyauto_functional # Must be imported before pyauto | 9 import pyauto_functional # Must be imported before pyauto |
10 import pyauto | 10 import pyauto |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 internal_flash_elem = pyauto_utils.WaitForDomElement(self, driver, | 123 internal_flash_elem = pyauto_utils.WaitForDomElement(self, driver, |
124 './/*[contains(text(), "gcswf32.dll")]') | 124 './/*[contains(text(), "gcswf32.dll")]') |
125 | 125 |
126 # Disable internal Flash plugin. | 126 # Disable internal Flash plugin. |
127 internal_flash_disable_link = internal_flash_elem.find_element_by_xpath( | 127 internal_flash_disable_link = internal_flash_elem.find_element_by_xpath( |
128 './/ancestor::*[@class="plugin-details"]//a[text()="Disable"]') | 128 './/ancestor::*[@class="plugin-details"]//a[text()="Disable"]') |
129 internal_flash_disable_link.click() | 129 internal_flash_disable_link.click() |
130 | 130 |
131 # Verify internal flash is disabled. | 131 # Verify internal flash is disabled. |
132 pyauto_utils.WaitForDomElement(self, internal_flash_elem, | 132 pyauto_utils.WaitForDomElement(self, internal_flash_elem, |
133 './/ancestor::*[@class="plugin-file-disabled"]') | 133 './/ancestor::*[@class="plugin-disabled"]') |
134 self.assertTrue(self.WaitUntil(lambda: not | 134 self.assertTrue(self.WaitUntil(lambda: not |
135 self._IsEnabled('Shockwave Flash'))) | 135 self._IsEnabled('Shockwave Flash'))) |
136 | 136 |
137 # Enable internal Flash plugin. | 137 # Enable internal Flash plugin. |
138 internal_flash_enable_link = internal_flash_elem.find_element_by_xpath( | 138 internal_flash_enable_link = internal_flash_elem.find_element_by_xpath( |
139 './/ancestor::*[@class="plugin-details"]//a[text()="Enable"]') | 139 './/ancestor::*[@class="plugin-details"]//a[text()="Enable"]') |
140 internal_flash_enable_link.click() | 140 internal_flash_enable_link.click() |
141 self.assertTrue(self.WaitUntil(lambda: len( | 141 self.assertTrue(self.WaitUntil(lambda: len( |
142 internal_flash_elem.find_elements_by_xpath( | 142 internal_flash_elem.find_elements_by_xpath( |
143 './/ancestor::*[@class="plugin-file-enabled"]')) == 1), | 143 './/ancestor::*[@class="plugin-enabled"]')) > 0), |
144 msg='Failed to enable internal Flash plugin') | 144 msg='Failed to enable internal Flash plugin') |
145 self.assertTrue(self.WaitUntil(lambda: | 145 self.assertTrue(self.WaitUntil(lambda: |
146 self._IsEnabled('Shockwave Flash'))) | 146 self._IsEnabled('Shockwave Flash'))) |
147 | 147 |
148 # Disable all flash plugins. | 148 # Disable all flash plugins. |
149 flash_disable_all_path = """ | 149 flash_disable_all_path = """ |
150 .//ancestor::*[@class="plugin-text"]//following-sibling::* | 150 .//ancestor::*[@class="plugin-text"]//following-sibling::* |
151 [@class="plugin-actions"]//a[text()="Disable"] | 151 [@class="plugin-actions"]//a[text()="Disable"] |
152 """ | 152 """ |
153 flash_disable_all_link = internal_flash_elem.find_element_by_xpath( | 153 flash_disable_all_link = internal_flash_elem.find_element_by_xpath( |
(...skipping 14 matching lines...) Expand all Loading... |
168 # Re-enable Flash plugin from flash detail info. | 168 # Re-enable Flash plugin from flash detail info. |
169 flash_enable_link = flash_plugins_elem.find_element_by_xpath( | 169 flash_enable_link = flash_plugins_elem.find_element_by_xpath( |
170 './/a[text()="Enable"]') | 170 './/a[text()="Enable"]') |
171 flash_enable_link.click() | 171 flash_enable_link.click() |
172 self.assertTrue(self.WaitUntil(lambda: | 172 self.assertTrue(self.WaitUntil(lambda: |
173 self._IsEnabled('Shockwave Flash'))) | 173 self._IsEnabled('Shockwave Flash'))) |
174 | 174 |
175 | 175 |
176 if __name__ == '__main__': | 176 if __name__ == '__main__': |
177 pyauto_functional.Main() | 177 pyauto_functional.Main() |
OLD | NEW |