OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chromeos/policy/login_policy_test_base.h" | 10 #include "chrome/browser/chromeos/policy/login_policy_test_base.h" |
11 #include "chrome/browser/prefs/session_startup_pref.h" | 11 #include "chrome/browser/prefs/session_startup_pref.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
14 #include "chrome/browser/ui/host_desktop.h" | 14 #include "chrome/browser/ui/host_desktop.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
16 #include "policy/policy_constants.h" | 16 #include "policy/policy_constants.h" |
17 | 17 |
18 namespace policy { | 18 namespace policy { |
19 | 19 |
20 // Boolean parameter is used to run this test for webview (true) and for | 20 // Boolean parameter is used to run this test for webview (true) and for |
21 // iframe (false) GAIA sign in. | 21 // iframe (false) GAIA sign in. |
22 class UserCloudPolicyManagerTest : public LoginPolicyTestBase, | 22 class UserCloudPolicyManagerTest : public LoginPolicyTestBase, |
23 public testing::WithParamInterface<bool> { | 23 public testing::WithParamInterface<bool> { |
24 protected: | 24 protected: |
25 UserCloudPolicyManagerTest() : LoginPolicyTestBase() { | 25 UserCloudPolicyManagerTest() : LoginPolicyTestBase() { |
26 set_use_webview(GetParam()); | 26 set_use_webview(GetParam()); |
27 } | 27 } |
28 | 28 |
29 scoped_ptr<base::DictionaryValue> GetMandatoryPoliciesValue() const override { | 29 void GetMandatoryPoliciesValue(base::DictionaryValue* policy) const override { |
30 scoped_ptr<base::ListValue> list(new base::ListValue); | 30 scoped_ptr<base::ListValue> list(new base::ListValue); |
31 list->AppendString("chrome://policy"); | 31 list->AppendString("chrome://policy"); |
32 list->AppendString("chrome://about"); | 32 list->AppendString("chrome://about"); |
33 | 33 |
34 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); | 34 policy->Set(key::kRestoreOnStartupURLs, list.Pass()); |
35 dict->Set(key::kRestoreOnStartupURLs, list.Pass()); | 35 policy->SetInteger(key::kRestoreOnStartup, |
36 dict->SetInteger(key::kRestoreOnStartup, | 36 SessionStartupPref::kPrefValueURLs); |
37 SessionStartupPref::kPrefValueURLs); | |
38 | |
39 return dict; | |
40 } | 37 } |
41 | 38 |
42 private: | 39 private: |
43 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerTest); | 40 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerTest); |
44 }; | 41 }; |
45 | 42 |
46 IN_PROC_BROWSER_TEST_P(UserCloudPolicyManagerTest, StartSession) { | 43 IN_PROC_BROWSER_TEST_P(UserCloudPolicyManagerTest, StartSession) { |
47 const char* const kStartupURLs[] = {"chrome://policy", "chrome://about"}; | 44 const char* const kStartupURLs[] = {"chrome://policy", "chrome://about"}; |
48 | 45 |
49 SkipToLoginScreen(); | 46 SkipToLoginScreen(); |
(...skipping 14 matching lines...) Expand all Loading... |
64 EXPECT_EQ(GURL(kStartupURLs[i]), | 61 EXPECT_EQ(GURL(kStartupURLs[i]), |
65 tabs->GetWebContentsAt(i)->GetVisibleURL()); | 62 tabs->GetWebContentsAt(i)->GetVisibleURL()); |
66 } | 63 } |
67 } | 64 } |
68 | 65 |
69 INSTANTIATE_TEST_CASE_P(UserCloudPolicyManagerTestSuite, | 66 INSTANTIATE_TEST_CASE_P(UserCloudPolicyManagerTestSuite, |
70 UserCloudPolicyManagerTest, | 67 UserCloudPolicyManagerTest, |
71 testing::Bool()); | 68 testing::Bool()); |
72 | 69 |
73 } // namespace policy | 70 } // namespace policy |
OLD | NEW |