| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <utility> |
| 6 |
| 5 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 6 #include "base/macros.h" | 8 #include "base/macros.h" |
| 7 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/values.h" | 10 #include "base/values.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/chromeos/policy/login_policy_test_base.h" | 12 #include "chrome/browser/chromeos/policy/login_policy_test_base.h" |
| 11 #include "chrome/browser/prefs/session_startup_pref.h" | 13 #include "chrome/browser/prefs/session_startup_pref.h" |
| 12 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/host_desktop.h" | 16 #include "chrome/browser/ui/host_desktop.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 command_line->AppendSwitch(switches::kDisableChildAccountDetection); | 55 command_line->AppendSwitch(switches::kDisableChildAccountDetection); |
| 54 } | 56 } |
| 55 | 57 |
| 56 void RestoreOnStartupTestChromeOS::GetMandatoryPoliciesValue( | 58 void RestoreOnStartupTestChromeOS::GetMandatoryPoliciesValue( |
| 57 base::DictionaryValue* policy) const { | 59 base::DictionaryValue* policy) const { |
| 58 policy->SetInteger(key::kRestoreOnStartup, | 60 policy->SetInteger(key::kRestoreOnStartup, |
| 59 SessionStartupPref::kPrefValueURLs); | 61 SessionStartupPref::kPrefValueURLs); |
| 60 scoped_ptr<base::ListValue> urls(new base::ListValue); | 62 scoped_ptr<base::ListValue> urls(new base::ListValue); |
| 61 urls->AppendString(kStartUpURL1); | 63 urls->AppendString(kStartUpURL1); |
| 62 urls->AppendString(kStartUpURL2); | 64 urls->AppendString(kStartUpURL2); |
| 63 policy->Set(key::kRestoreOnStartupURLs, urls.Pass()); | 65 policy->Set(key::kRestoreOnStartupURLs, std::move(urls)); |
| 64 } | 66 } |
| 65 | 67 |
| 66 void RestoreOnStartupTestChromeOS::LogInAndVerifyStartUpURLs() { | 68 void RestoreOnStartupTestChromeOS::LogInAndVerifyStartUpURLs() { |
| 67 LogIn(kAccountId, kAccountPassword); | 69 LogIn(kAccountId, kAccountPassword); |
| 68 | 70 |
| 69 const BrowserList* const browser_list = | 71 const BrowserList* const browser_list = |
| 70 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 72 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
| 71 ASSERT_EQ(1U, browser_list->size()); | 73 ASSERT_EQ(1U, browser_list->size()); |
| 72 const Browser* const browser = browser_list->get(0); | 74 const Browser* const browser = browser_list->get(0); |
| 73 ASSERT_TRUE(browser); | 75 ASSERT_TRUE(browser); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 86 | 88 |
| 87 // Verify that the policies are honored on an existing user's login. | 89 // Verify that the policies are honored on an existing user's login. |
| 88 IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, LogInAndVerify) { | 90 IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, LogInAndVerify) { |
| 89 content::WindowedNotificationObserver( | 91 content::WindowedNotificationObserver( |
| 90 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 92 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
| 91 content::NotificationService::AllSources()).Wait(); | 93 content::NotificationService::AllSources()).Wait(); |
| 92 LogInAndVerifyStartUpURLs(); | 94 LogInAndVerifyStartUpURLs(); |
| 93 } | 95 } |
| 94 | 96 |
| 95 } // namespace policy | 97 } // namespace policy |
| OLD | NEW |