| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 base::CommandLine* command_line) { | 1177 base::CommandLine* command_line) { |
| 1178 command_line->AppendSwitch(switches::kForceFirstRun); | 1178 command_line->AppendSwitch(switches::kForceFirstRun); |
| 1179 } | 1179 } |
| 1180 | 1180 |
| 1181 void StartupBrowserCreatorFirstRunTest::SetUpInProcessBrowserTestFixture() { | 1181 void StartupBrowserCreatorFirstRunTest::SetUpInProcessBrowserTestFixture() { |
| 1182 #if defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) | 1182 #if defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) |
| 1183 // Set a policy that prevents the first-run dialog from being shown. | 1183 // Set a policy that prevents the first-run dialog from being shown. |
| 1184 policy_map_.Set(policy::key::kMetricsReportingEnabled, | 1184 policy_map_.Set(policy::key::kMetricsReportingEnabled, |
| 1185 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, | 1185 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, |
| 1186 policy::POLICY_SOURCE_CLOUD, | 1186 policy::POLICY_SOURCE_CLOUD, |
| 1187 base::MakeUnique<base::FundamentalValue>(false), nullptr); | 1187 base::MakeUnique<base::Value>(false), nullptr); |
| 1188 provider_.UpdateChromePolicy(policy_map_); | 1188 provider_.UpdateChromePolicy(policy_map_); |
| 1189 #endif // defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) | 1189 #endif // defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) |
| 1190 | 1190 |
| 1191 EXPECT_CALL(provider_, IsInitializationComplete(_)) | 1191 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 1192 .WillRepeatedly(Return(true)); | 1192 .WillRepeatedly(Return(true)); |
| 1193 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | 1193 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
| 1194 } | 1194 } |
| 1195 | 1195 |
| 1196 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 1196 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) |
| 1197 // http://crbug.com/314819 | 1197 // http://crbug.com/314819 |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 browser()->profile()->GetPrefs()->SetBoolean( | 1539 browser()->profile()->GetPrefs()->SetBoolean( |
| 1540 prefs::kSignInPromoShowOnFirstRunAllowed, true); | 1540 prefs::kSignInPromoShowOnFirstRunAllowed, true); |
| 1541 | 1541 |
| 1542 // Set the following user policies: | 1542 // Set the following user policies: |
| 1543 // * RestoreOnStartup = RestoreOnStartupIsURLs | 1543 // * RestoreOnStartup = RestoreOnStartupIsURLs |
| 1544 // * RestoreOnStartupURLs = [ "/title1.html" ] | 1544 // * RestoreOnStartupURLs = [ "/title1.html" ] |
| 1545 policy_map_.Set( | 1545 policy_map_.Set( |
| 1546 policy::key::kRestoreOnStartup, policy::POLICY_LEVEL_MANDATORY, | 1546 policy::key::kRestoreOnStartup, policy::POLICY_LEVEL_MANDATORY, |
| 1547 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, | 1547 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, |
| 1548 base::WrapUnique( | 1548 base::WrapUnique( |
| 1549 new base::FundamentalValue(SessionStartupPref::kPrefValueURLs)), | 1549 new base::Value(SessionStartupPref::kPrefValueURLs)), |
| 1550 nullptr); | 1550 nullptr); |
| 1551 base::ListValue startup_urls; | 1551 base::ListValue startup_urls; |
| 1552 startup_urls.AppendString( | 1552 startup_urls.AppendString( |
| 1553 embedded_test_server()->GetURL("/title1.html").spec()); | 1553 embedded_test_server()->GetURL("/title1.html").spec()); |
| 1554 policy_map_.Set(policy::key::kRestoreOnStartupURLs, | 1554 policy_map_.Set(policy::key::kRestoreOnStartupURLs, |
| 1555 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, | 1555 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, |
| 1556 policy::POLICY_SOURCE_CLOUD, startup_urls.CreateDeepCopy(), | 1556 policy::POLICY_SOURCE_CLOUD, startup_urls.CreateDeepCopy(), |
| 1557 nullptr); | 1557 nullptr); |
| 1558 provider_.UpdateChromePolicy(policy_map_); | 1558 provider_.UpdateChromePolicy(policy_map_); |
| 1559 base::RunLoop().RunUntilIdle(); | 1559 base::RunLoop().RunUntilIdle(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 ASSERT_TRUE(new_browser); | 1619 ASSERT_TRUE(new_browser); |
| 1620 | 1620 |
| 1621 // Verify that the first-run tab is shown and no other pages are present. | 1621 // Verify that the first-run tab is shown and no other pages are present. |
| 1622 TabStripModel* tab_strip = new_browser->tab_strip_model(); | 1622 TabStripModel* tab_strip = new_browser->tab_strip_model(); |
| 1623 ASSERT_EQ(1, tab_strip->count()); | 1623 ASSERT_EQ(1, tab_strip->count()); |
| 1624 EXPECT_EQ("title1.html", | 1624 EXPECT_EQ("title1.html", |
| 1625 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 1625 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
| 1626 } | 1626 } |
| 1627 | 1627 |
| 1628 #endif // !defined(OS_CHROMEOS) | 1628 #endif // !defined(OS_CHROMEOS) |
| OLD | NEW |