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"]')) >= 1), |
Nirnimesh
2012/04/26 18:45:05
are there many of these 'plugin-enabled' elements?
vivianz
2012/04/26 18:50:58
there used to be 2 set plugin-enabled and plugin-f
Nirnimesh
2012/04/26 19:06:14
I understand what you're trying to do, but I don't
dyu1
2012/04/26 19:14:52
Do they both need to be enabled? Are the plugins e
vivianz
2012/04/26 22:08:58
yes, before the click on line 140, the class name
vivianz
2012/04/26 22:08:58
because now after developer make plugin-file-[some
Nirnimesh
2012/04/26 22:19:58
then why not match to 2? Why >= 1?
vivianz
2012/04/26 22:30:51
I could, I make it >=1 in case dev make another on
Nirnimesh
2012/04/26 22:33:39
Before the click happens, what's the count? 1?
If
vivianz
2012/04/26 22:42:56
before the click , the class name is plugin-disabl
Nirnimesh
2012/04/26 23:00:07
I think you should do a strict match. ie == 1 here
vivianz
2012/04/26 23:15:04
I can make it ==2, but I just don't see the point
Nirnimesh
2012/04/26 23:21:33
I want to ensure that reality is coded in here.
Op
vivianz
2012/04/26 23:37:23
got it, I will change it to >0 tomorrow, that make
vivianz
2012/04/27 18:00:32
Done.
| |
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 |