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 <cstdlib> | 6 #include <cstdlib> |
7 #include <map> | 7 #include <map> |
8 #include <sstream> | 8 #include <sstream> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 EXPECT_CALL(provider_, IsInitializationComplete(_)) | 453 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
454 .WillRepeatedly(Return(true)); | 454 .WillRepeatedly(Return(true)); |
455 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | 455 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
456 } | 456 } |
457 | 457 |
458 virtual void SetUpOnMainThread() OVERRIDE { | 458 virtual void SetUpOnMainThread() OVERRIDE { |
459 ui_test_utils::WaitForTemplateURLServiceToLoad( | 459 ui_test_utils::WaitForTemplateURLServiceToLoad( |
460 TemplateURLServiceFactory::GetForProfile(browser()->profile())); | 460 TemplateURLServiceFactory::GetForProfile(browser()->profile())); |
461 } | 461 } |
462 | 462 |
| 463 virtual void TearDownOnMainThread() OVERRIDE { |
| 464 ClearProviderPolicy(); |
| 465 } |
| 466 |
463 void ClearProviderPolicy() { | 467 void ClearProviderPolicy() { |
464 provider_.UpdateChromePolicy(PolicyMap()); | 468 provider_.UpdateChromePolicy(PolicyMap()); |
465 base::RunLoop().RunUntilIdle(); | 469 base::RunLoop().RunUntilIdle(); |
466 } | 470 } |
467 | 471 |
468 void SetProviderPolicy(const base::DictionaryValue& policies, | 472 void SetProviderPolicy(const base::DictionaryValue& policies, |
469 PolicyLevel level) { | 473 PolicyLevel level) { |
470 PolicyMap policy_map; | 474 PolicyMap policy_map; |
471 for (base::DictionaryValue::Iterator it(policies); | 475 for (base::DictionaryValue::Iterator it(policies); |
472 !it.IsAtEnd(); it.Advance()) { | 476 !it.IsAtEnd(); it.Advance()) { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 } | 668 } |
665 } | 669 } |
666 } | 670 } |
667 } | 671 } |
668 | 672 |
669 INSTANTIATE_TEST_CASE_P(PolicyPrefIndicatorTestInstance, | 673 INSTANTIATE_TEST_CASE_P(PolicyPrefIndicatorTestInstance, |
670 PolicyPrefIndicatorTest, | 674 PolicyPrefIndicatorTest, |
671 testing::ValuesIn(SplitPoliciesIntoChunks(50))); | 675 testing::ValuesIn(SplitPoliciesIntoChunks(50))); |
672 | 676 |
673 } // namespace policy | 677 } // namespace policy |
OLD | NEW |