| 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 #include <utility> |
| 6 | 7 |
| 7 #include "base/macros.h" | 8 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 10 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/policy/login_policy_test_base.h" | 11 #include "chrome/browser/chromeos/policy/login_policy_test_base.h" |
| 11 #include "chrome/browser/prefs/session_startup_pref.h" | 12 #include "chrome/browser/prefs/session_startup_pref.h" |
| 12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/host_desktop.h" | 15 #include "chrome/browser/ui/host_desktop.h" |
| 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 16 #include "policy/policy_constants.h" | 17 #include "policy/policy_constants.h" |
| 17 | 18 |
| 18 namespace policy { | 19 namespace policy { |
| 19 | 20 |
| 20 class UserCloudPolicyManagerTest : public LoginPolicyTestBase { | 21 class UserCloudPolicyManagerTest : public LoginPolicyTestBase { |
| 21 protected: | 22 protected: |
| 22 UserCloudPolicyManagerTest() {} | 23 UserCloudPolicyManagerTest() {} |
| 23 | 24 |
| 24 void GetMandatoryPoliciesValue(base::DictionaryValue* policy) const override { | 25 void GetMandatoryPoliciesValue(base::DictionaryValue* policy) const override { |
| 25 scoped_ptr<base::ListValue> list(new base::ListValue); | 26 scoped_ptr<base::ListValue> list(new base::ListValue); |
| 26 list->AppendString("chrome://policy"); | 27 list->AppendString("chrome://policy"); |
| 27 list->AppendString("chrome://about"); | 28 list->AppendString("chrome://about"); |
| 28 | 29 |
| 29 policy->Set(key::kRestoreOnStartupURLs, list.Pass()); | 30 policy->Set(key::kRestoreOnStartupURLs, std::move(list)); |
| 30 policy->SetInteger(key::kRestoreOnStartup, | 31 policy->SetInteger(key::kRestoreOnStartup, |
| 31 SessionStartupPref::kPrefValueURLs); | 32 SessionStartupPref::kPrefValueURLs); |
| 32 } | 33 } |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerTest); | 36 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerTest); |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 IN_PROC_BROWSER_TEST_F(UserCloudPolicyManagerTest, StartSession) { | 39 IN_PROC_BROWSER_TEST_F(UserCloudPolicyManagerTest, StartSession) { |
| 39 const char* const kStartupURLs[] = {"chrome://policy", "chrome://about"}; | 40 const char* const kStartupURLs[] = {"chrome://policy", "chrome://about"}; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 52 ASSERT_TRUE(tabs); | 53 ASSERT_TRUE(tabs); |
| 53 const int expected_tab_count = static_cast<int>(arraysize(kStartupURLs)); | 54 const int expected_tab_count = static_cast<int>(arraysize(kStartupURLs)); |
| 54 EXPECT_EQ(expected_tab_count, tabs->count()); | 55 EXPECT_EQ(expected_tab_count, tabs->count()); |
| 55 for (int i = 0; i < expected_tab_count && i < tabs->count(); ++i) { | 56 for (int i = 0; i < expected_tab_count && i < tabs->count(); ++i) { |
| 56 EXPECT_EQ(GURL(kStartupURLs[i]), | 57 EXPECT_EQ(GURL(kStartupURLs[i]), |
| 57 tabs->GetWebContentsAt(i)->GetVisibleURL()); | 58 tabs->GetWebContentsAt(i)->GetVisibleURL()); |
| 58 } | 59 } |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace policy | 62 } // namespace policy |
| OLD | NEW |