OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <map> | 6 #include <map> |
7 #include <sstream> | 7 #include <sstream> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } | 291 } |
292 | 292 |
293 void VerifyControlledSettingIndicators(Browser* browser, | 293 void VerifyControlledSettingIndicators(Browser* browser, |
294 const std::string& pref, | 294 const std::string& pref, |
295 const std::string& value, | 295 const std::string& value, |
296 const std::string& controlled_by, | 296 const std::string& controlled_by, |
297 bool readonly) { | 297 bool readonly) { |
298 std::wstringstream javascript; | 298 std::wstringstream javascript; |
299 javascript << "var nodes = document.querySelectorAll(" | 299 javascript << "var nodes = document.querySelectorAll(" |
300 << " 'span.controlled-setting-indicator[" | 300 << " 'span.controlled-setting-indicator[" |
301 << " pref=" << pref.c_str() << "]');" | 301 << " pref=\"" << pref.c_str() << "\"]');" |
302 << "var indicators = [];" | 302 << "var indicators = [];" |
303 << "for (var i = 0; i < nodes.length; i++) {" | 303 << "for (var i = 0; i < nodes.length; i++) {" |
304 << " var node = nodes[i];" | 304 << " var node = nodes[i];" |
305 << " var indicator = {};" | 305 << " var indicator = {};" |
306 << " indicator.value = node.value || '';" | 306 << " indicator.value = node.value || '';" |
307 << " indicator.controlledBy = node.controlledBy || '';" | 307 << " indicator.controlledBy = node.controlledBy || '';" |
308 << " indicator.readOnly = node.readOnly || false;" | 308 << " indicator.readOnly = node.readOnly || false;" |
309 << " indicator.visible =" | 309 << " indicator.visible =" |
310 << " window.getComputedStyle(node).display != 'none';" | 310 << " window.getComputedStyle(node).display != 'none';" |
311 << " indicators.push(indicator)" | 311 << " indicators.push(indicator)" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 } | 537 } |
538 } | 538 } |
539 | 539 |
540 INSTANTIATE_TEST_CASE_P( | 540 INSTANTIATE_TEST_CASE_P( |
541 PolicyPrefsTestInstance, | 541 PolicyPrefsTestInstance, |
542 PolicyPrefsTest, | 542 PolicyPrefsTest, |
543 testing::ValuesIn(GetChromePolicyDefinitionList()->begin, | 543 testing::ValuesIn(GetChromePolicyDefinitionList()->begin, |
544 GetChromePolicyDefinitionList()->end)); | 544 GetChromePolicyDefinitionList()->end)); |
545 | 545 |
546 } // namespace policy | 546 } // namespace policy |
OLD | NEW |