Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: chrome/browser/policy/policy_prefs_browsertest.cc

Issue 11198065: Add fourth batch of controlled setting indicators (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed two obsoleted test cases. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/options/browser_options.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 const base::ListValue* indicators = NULL; 375 const base::ListValue* indicators = NULL;
376 ASSERT_TRUE(value_ptr.get()); 376 ASSERT_TRUE(value_ptr.get());
377 ASSERT_TRUE(value_ptr->GetAsList(&indicators)); 377 ASSERT_TRUE(value_ptr->GetAsList(&indicators));
378 // Verify that controlled setting indicators representing |value| are visible 378 // Verify that controlled setting indicators representing |value| are visible
379 // and have the correct state while those not representing |value| are 379 // and have the correct state while those not representing |value| are
380 // invisible. 380 // invisible.
381 if (!controlled_by.empty()) { 381 if (!controlled_by.empty()) {
382 EXPECT_GT(indicators->GetSize(), 0u) 382 EXPECT_GT(indicators->GetSize(), 0u)
383 << "Expected to find at least one controlled setting indicator."; 383 << "Expected to find at least one controlled setting indicator.";
384 } 384 }
385 bool have_visible_indicators = false;
385 for (base::ListValue::const_iterator indicator = indicators->begin(); 386 for (base::ListValue::const_iterator indicator = indicators->begin();
386 indicator != indicators->end(); ++indicator) { 387 indicator != indicators->end(); ++indicator) {
387 const base::DictionaryValue* properties = NULL; 388 const base::DictionaryValue* properties = NULL;
388 ASSERT_TRUE((*indicator)->GetAsDictionary(&properties)); 389 ASSERT_TRUE((*indicator)->GetAsDictionary(&properties));
389 std::string indicator_value; 390 std::string indicator_value;
390 std::string indicator_controlled_by; 391 std::string indicator_controlled_by;
391 bool indicator_readonly; 392 bool indicator_readonly;
392 bool indicator_visible; 393 bool indicator_visible;
393 EXPECT_TRUE(properties->GetString("value", &indicator_value)); 394 EXPECT_TRUE(properties->GetString("value", &indicator_value));
394 EXPECT_TRUE(properties->GetString("controlledBy", 395 EXPECT_TRUE(properties->GetString("controlledBy",
395 &indicator_controlled_by)); 396 &indicator_controlled_by));
396 EXPECT_TRUE(properties->GetBoolean("readOnly", &indicator_readonly)); 397 EXPECT_TRUE(properties->GetBoolean("readOnly", &indicator_readonly));
397 EXPECT_TRUE(properties->GetBoolean("visible", &indicator_visible)); 398 EXPECT_TRUE(properties->GetBoolean("visible", &indicator_visible));
398 if (!controlled_by.empty() && (indicator_value == value)) { 399 if (!controlled_by.empty() && (indicator_value == value)) {
399 EXPECT_EQ(controlled_by, indicator_controlled_by); 400 EXPECT_EQ(controlled_by, indicator_controlled_by);
400 EXPECT_EQ(readonly, indicator_readonly); 401 EXPECT_EQ(readonly, indicator_readonly);
401 EXPECT_TRUE(indicator_visible); 402 EXPECT_TRUE(indicator_visible);
403 have_visible_indicators = true;
402 } else { 404 } else {
403 EXPECT_FALSE(indicator_visible); 405 EXPECT_FALSE(indicator_visible);
404 } 406 }
405 } 407 }
408 if (!controlled_by.empty()) {
409 EXPECT_TRUE(have_visible_indicators)
410 << "Expected to find at least one visible controlled setting "
411 << "indicator.";
412 }
406 } 413 }
407 414
408 } // namespace 415 } // namespace
409 416
410 // A class of tests parameterized by a settings page URL. 417 // A class of tests parameterized by a settings page URL.
411 class PolicyPrefsSettingsBannerTest 418 class PolicyPrefsSettingsBannerTest
412 : public InProcessBrowserTest, 419 : public InProcessBrowserTest,
413 public testing::WithParamInterface<const char*> {}; 420 public testing::WithParamInterface<const char*> {};
414 421
415 // Base class for tests that change policies. 422 // Base class for tests that change policies.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 } 642 }
636 } 643 }
637 644
638 INSTANTIATE_TEST_CASE_P( 645 INSTANTIATE_TEST_CASE_P(
639 PolicyPrefsTestInstance, 646 PolicyPrefsTestInstance,
640 PolicyPrefsTest, 647 PolicyPrefsTest,
641 testing::ValuesIn(GetChromePolicyDefinitionList()->begin, 648 testing::ValuesIn(GetChromePolicyDefinitionList()->begin,
642 GetChromePolicyDefinitionList()->end)); 649 GetChromePolicyDefinitionList()->end));
643 650
644 } // namespace policy 651 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/options/browser_options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698