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 19 matching lines...) Expand all Loading... |
30 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
31 #include "chrome/test/base/in_process_browser_test.h" | 31 #include "chrome/test/base/in_process_browser_test.h" |
32 #include "chrome/test/base/ui_test_utils.h" | 32 #include "chrome/test/base/ui_test_utils.h" |
33 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
34 #include "content/public/test/browser_test_utils.h" | 34 #include "content/public/test/browser_test_utils.h" |
35 #include "policy/policy_constants.h" | 35 #include "policy/policy_constants.h" |
36 #include "testing/gmock/include/gmock/gmock.h" | 36 #include "testing/gmock/include/gmock/gmock.h" |
37 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
38 #include "url/gurl.h" | 38 #include "url/gurl.h" |
39 | 39 |
40 using testing::AnyNumber; | |
41 using testing::Return; | 40 using testing::Return; |
42 using testing::_; | 41 using testing::_; |
43 | 42 |
44 namespace policy { | 43 namespace policy { |
45 | 44 |
46 namespace { | 45 namespace { |
47 | 46 |
48 const char kMainSettingsPage[] = "chrome://settings-frame"; | 47 const char kMainSettingsPage[] = "chrome://settings-frame"; |
49 | 48 |
50 const char kCrosSettingsPrefix[] = "cros."; | 49 const char kCrosSettingsPrefix[] = "cros."; |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 381 |
383 // Base class for tests that change policy and are parameterized with a policy | 382 // Base class for tests that change policy and are parameterized with a policy |
384 // definition. | 383 // definition. |
385 class PolicyPrefsTest | 384 class PolicyPrefsTest |
386 : public InProcessBrowserTest, | 385 : public InProcessBrowserTest, |
387 public testing::WithParamInterface<PolicyDefinitionList::Entry> { | 386 public testing::WithParamInterface<PolicyDefinitionList::Entry> { |
388 protected: | 387 protected: |
389 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 388 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
390 EXPECT_CALL(provider_, IsInitializationComplete(_)) | 389 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
391 .WillRepeatedly(Return(true)); | 390 .WillRepeatedly(Return(true)); |
392 EXPECT_CALL(provider_, RegisterPolicyDomain(_)).Times(AnyNumber()); | |
393 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | 391 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
394 } | 392 } |
395 | 393 |
396 virtual void SetUpOnMainThread() OVERRIDE { | 394 virtual void SetUpOnMainThread() OVERRIDE { |
397 ui_test_utils::WaitForTemplateURLServiceToLoad( | 395 ui_test_utils::WaitForTemplateURLServiceToLoad( |
398 TemplateURLServiceFactory::GetForProfile(browser()->profile())); | 396 TemplateURLServiceFactory::GetForProfile(browser()->profile())); |
399 } | 397 } |
400 | 398 |
401 void UpdateProviderPolicy(const PolicyMap& policy) { | 399 void UpdateProviderPolicy(const PolicyMap& policy) { |
402 provider_.UpdateChromePolicy(policy); | 400 provider_.UpdateChromePolicy(policy); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 } | 564 } |
567 } | 565 } |
568 | 566 |
569 INSTANTIATE_TEST_CASE_P( | 567 INSTANTIATE_TEST_CASE_P( |
570 PolicyPrefsTestInstance, | 568 PolicyPrefsTestInstance, |
571 PolicyPrefsTest, | 569 PolicyPrefsTest, |
572 testing::ValuesIn(GetChromePolicyDefinitionList()->begin, | 570 testing::ValuesIn(GetChromePolicyDefinitionList()->begin, |
573 GetChromePolicyDefinitionList()->end)); | 571 GetChromePolicyDefinitionList()->end)); |
574 | 572 |
575 } // namespace policy | 573 } // namespace policy |
OLD | NEW |