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 "chrome/browser/ui/webui/options/preferences_browsertest.h" | 5 #include "chrome/browser/ui/webui/options/preferences_browsertest.h" |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "policy/policy_constants.h" | 32 #include "policy/policy_constants.h" |
33 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
34 | 34 |
35 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
36 #include "chrome/browser/chromeos/proxy_cros_settings_parser.h" | 36 #include "chrome/browser/chromeos/proxy_cros_settings_parser.h" |
37 #include "chrome/browser/chromeos/settings/cros_settings.h" | 37 #include "chrome/browser/chromeos/settings/cros_settings.h" |
38 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 38 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
39 #endif | 39 #endif |
40 | 40 |
41 using testing::AllOf; | 41 using testing::AllOf; |
| 42 using testing::AnyNumber; |
42 using testing::Mock; | 43 using testing::Mock; |
43 using testing::Property; | 44 using testing::Property; |
44 using testing::AnyNumber; | |
45 using testing::Return; | 45 using testing::Return; |
46 using testing::_; | 46 using testing::_; |
47 | 47 |
48 namespace base { | 48 namespace base { |
49 | 49 |
50 // Helper for using EXPECT_EQ() with base::Value. | 50 // Helper for using EXPECT_EQ() with base::Value. |
51 bool operator==(const Value& first, const Value& second) { | 51 bool operator==(const Value& first, const Value& second) { |
52 return first.Equals(&second); | 52 return first.Equals(&second); |
53 } | 53 } |
54 | 54 |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 pref_names_.push_back(prefs::kAlternateErrorPagesEnabled); | 429 pref_names_.push_back(prefs::kAlternateErrorPagesEnabled); |
430 policy_names_.push_back(policy::key::kAlternateErrorPagesEnabled); | 430 policy_names_.push_back(policy::key::kAlternateErrorPagesEnabled); |
431 non_default_values_.push_back(new base::FundamentalValue(false)); | 431 non_default_values_.push_back(new base::FundamentalValue(false)); |
432 | 432 |
433 // Integer pref. | 433 // Integer pref. |
434 types_.push_back("Integer"); | 434 types_.push_back("Integer"); |
435 pref_names_.push_back(prefs::kRestoreOnStartup); | 435 pref_names_.push_back(prefs::kRestoreOnStartup); |
436 policy_names_.push_back(policy::key::kRestoreOnStartup); | 436 policy_names_.push_back(policy::key::kRestoreOnStartup); |
437 non_default_values_.push_back(new base::FundamentalValue(4)); | 437 non_default_values_.push_back(new base::FundamentalValue(4)); |
438 | 438 |
439 // String pref. | |
440 types_.push_back("String"); | |
441 pref_names_.push_back(prefs::kEnterpriseWebStoreName); | |
442 policy_names_.push_back(policy::key::kEnterpriseWebStoreName); | |
443 non_default_values_.push_back(new base::StringValue("Store")); | |
444 | |
445 // URL pref. | |
446 types_.push_back("URL"); | |
447 pref_names_.push_back(prefs::kEnterpriseWebStoreURL); | |
448 policy_names_.push_back(policy::key::kEnterpriseWebStoreURL); | |
449 non_default_values_.push_back( | |
450 new base::StringValue("http://www.google.com/")); | |
451 | |
452 // List pref. | 439 // List pref. |
453 if (includeListPref) { | 440 if (includeListPref) { |
454 types_.push_back("List"); | 441 types_.push_back("List"); |
455 pref_names_.push_back(prefs::kURLsToRestoreOnStartup); | 442 pref_names_.push_back(prefs::kURLsToRestoreOnStartup); |
456 policy_names_.push_back(policy::key::kRestoreOnStartupURLs); | 443 policy_names_.push_back(policy::key::kRestoreOnStartupURLs); |
457 base::ListValue* list = new base::ListValue; | 444 base::ListValue* list = new base::ListValue; |
458 list->Append(new base::StringValue("http://www.google.com")); | 445 list->Append(new base::StringValue("http://www.google.com")); |
459 list->Append(new base::StringValue("http://example.com")); | 446 list->Append(new base::StringValue("http://example.com")); |
460 non_default_values_.push_back(list); | 447 non_default_values_.push_back(list); |
461 } | 448 } |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 // Do not set the Boolean pref. It will toogle automatically. | 733 // Do not set the Boolean pref. It will toogle automatically. |
747 for (size_t i = 1; i < pref_names_.size(); ++i) | 734 for (size_t i = 1; i < pref_names_.size(); ++i) |
748 chromeos::proxy_cros_settings_parser::SetProxyPrefValue( | 735 chromeos::proxy_cros_settings_parser::SetProxyPrefValue( |
749 profile, pref_names_[i], non_default_values_[i]->DeepCopy()); | 736 profile, pref_names_[i], non_default_values_[i]->DeepCopy()); |
750 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); | 737 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); |
751 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, | 738 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, |
752 "", false, false); | 739 "", false, false); |
753 } | 740 } |
754 | 741 |
755 #endif | 742 #endif |
OLD | NEW |