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> | 5 #include <utility> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 SessionStartupPref::kPrefValueURLs); | 61 SessionStartupPref::kPrefValueURLs); |
62 scoped_ptr<base::ListValue> urls(new base::ListValue); | 62 scoped_ptr<base::ListValue> urls(new base::ListValue); |
63 urls->AppendString(kStartUpURL1); | 63 urls->AppendString(kStartUpURL1); |
64 urls->AppendString(kStartUpURL2); | 64 urls->AppendString(kStartUpURL2); |
65 policy->Set(key::kRestoreOnStartupURLs, std::move(urls)); | 65 policy->Set(key::kRestoreOnStartupURLs, std::move(urls)); |
66 } | 66 } |
67 | 67 |
68 void RestoreOnStartupTestChromeOS::LogInAndVerifyStartUpURLs() { | 68 void RestoreOnStartupTestChromeOS::LogInAndVerifyStartUpURLs() { |
69 LogIn(kAccountId, kAccountPassword); | 69 LogIn(kAccountId, kAccountPassword); |
70 | 70 |
71 const BrowserList* const browser_list = | 71 const BrowserList* const browser_list = BrowserList::GetInstance(); |
72 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | |
73 ASSERT_EQ(1U, browser_list->size()); | 72 ASSERT_EQ(1U, browser_list->size()); |
74 const Browser* const browser = browser_list->get(0); | 73 const Browser* const browser = browser_list->get(0); |
75 ASSERT_TRUE(browser); | 74 ASSERT_TRUE(browser); |
76 const TabStripModel* tabs = browser->tab_strip_model(); | 75 const TabStripModel* tabs = browser->tab_strip_model(); |
77 ASSERT_TRUE(tabs); | 76 ASSERT_TRUE(tabs); |
78 ASSERT_EQ(2, tabs->count()); | 77 ASSERT_EQ(2, tabs->count()); |
79 EXPECT_EQ(GURL(kStartUpURL1), tabs->GetWebContentsAt(0)->GetURL()); | 78 EXPECT_EQ(GURL(kStartUpURL1), tabs->GetWebContentsAt(0)->GetURL()); |
80 EXPECT_EQ(GURL(kStartUpURL2), tabs->GetWebContentsAt(1)->GetURL()); | 79 EXPECT_EQ(GURL(kStartUpURL2), tabs->GetWebContentsAt(1)->GetURL()); |
81 } | 80 } |
82 | 81 |
83 // Verify that the policies are honored on a new user's login. | 82 // Verify that the policies are honored on a new user's login. |
84 IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, PRE_LogInAndVerify) { | 83 IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, PRE_LogInAndVerify) { |
85 SkipToLoginScreen(); | 84 SkipToLoginScreen(); |
86 LogInAndVerifyStartUpURLs(); | 85 LogInAndVerifyStartUpURLs(); |
87 } | 86 } |
88 | 87 |
89 // Verify that the policies are honored on an existing user's login. | 88 // Verify that the policies are honored on an existing user's login. |
90 IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, LogInAndVerify) { | 89 IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, LogInAndVerify) { |
91 content::WindowedNotificationObserver( | 90 content::WindowedNotificationObserver( |
92 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 91 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
93 content::NotificationService::AllSources()).Wait(); | 92 content::NotificationService::AllSources()).Wait(); |
94 LogInAndVerifyStartUpURLs(); | 93 LogInAndVerifyStartUpURLs(); |
95 } | 94 } |
96 | 95 |
97 } // namespace policy | 96 } // namespace policy |
OLD | NEW |