| 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 <memory> |
| 5 #include <utility> | 6 #include <utility> |
| 6 | 7 |
| 7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/chromeos/policy/login_policy_test_base.h" | 12 #include "chrome/browser/chromeos/policy/login_policy_test_base.h" |
| 13 #include "chrome/browser/prefs/session_startup_pref.h" | 13 #include "chrome/browser/prefs/session_startup_pref.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
| 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 void RestoreOnStartupTestChromeOS::SetUpCommandLine( | 51 void RestoreOnStartupTestChromeOS::SetUpCommandLine( |
| 52 base::CommandLine* command_line) { | 52 base::CommandLine* command_line) { |
| 53 LoginPolicyTestBase::SetUpCommandLine(command_line); | 53 LoginPolicyTestBase::SetUpCommandLine(command_line); |
| 54 command_line->AppendSwitch(switches::kDisableChildAccountDetection); | 54 command_line->AppendSwitch(switches::kDisableChildAccountDetection); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void RestoreOnStartupTestChromeOS::GetMandatoryPoliciesValue( | 57 void RestoreOnStartupTestChromeOS::GetMandatoryPoliciesValue( |
| 58 base::DictionaryValue* policy) const { | 58 base::DictionaryValue* policy) const { |
| 59 policy->SetInteger(key::kRestoreOnStartup, | 59 policy->SetInteger(key::kRestoreOnStartup, |
| 60 SessionStartupPref::kPrefValueURLs); | 60 SessionStartupPref::kPrefValueURLs); |
| 61 scoped_ptr<base::ListValue> urls(new base::ListValue); | 61 std::unique_ptr<base::ListValue> urls(new base::ListValue); |
| 62 urls->AppendString(kStartUpURL1); | 62 urls->AppendString(kStartUpURL1); |
| 63 urls->AppendString(kStartUpURL2); | 63 urls->AppendString(kStartUpURL2); |
| 64 policy->Set(key::kRestoreOnStartupURLs, std::move(urls)); | 64 policy->Set(key::kRestoreOnStartupURLs, std::move(urls)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void RestoreOnStartupTestChromeOS::LogInAndVerifyStartUpURLs() { | 67 void RestoreOnStartupTestChromeOS::LogInAndVerifyStartUpURLs() { |
| 68 LogIn(kAccountId, kAccountPassword); | 68 LogIn(kAccountId, kAccountPassword); |
| 69 | 69 |
| 70 const BrowserList* const browser_list = BrowserList::GetInstance(); | 70 const BrowserList* const browser_list = BrowserList::GetInstance(); |
| 71 ASSERT_EQ(1U, browser_list->size()); | 71 ASSERT_EQ(1U, browser_list->size()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 86 | 86 |
| 87 // Verify that the policies are honored on an existing user's login. | 87 // Verify that the policies are honored on an existing user's login. |
| 88 IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, LogInAndVerify) { | 88 IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, LogInAndVerify) { |
| 89 content::WindowedNotificationObserver( | 89 content::WindowedNotificationObserver( |
| 90 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 90 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
| 91 content::NotificationService::AllSources()).Wait(); | 91 content::NotificationService::AllSources()).Wait(); |
| 92 LogInAndVerifyStartUpURLs(); | 92 LogInAndVerifyStartUpURLs(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace policy | 95 } // namespace policy |
| OLD | NEW |