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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 // "show_on_first_run_allowed": true | 1398 // "show_on_first_run_allowed": true |
1399 // } | 1399 // } |
1400 // } | 1400 // } |
1401 StartupBrowserCreator browser_creator; | 1401 StartupBrowserCreator browser_creator; |
1402 browser()->profile()->GetPrefs()->SetBoolean( | 1402 browser()->profile()->GetPrefs()->SetBoolean( |
1403 prefs::kSignInPromoShowOnFirstRunAllowed, true); | 1403 prefs::kSignInPromoShowOnFirstRunAllowed, true); |
1404 | 1404 |
1405 // Set the following user policies: | 1405 // Set the following user policies: |
1406 // * RestoreOnStartup = RestoreOnStartupIsURLs | 1406 // * RestoreOnStartup = RestoreOnStartupIsURLs |
1407 // * RestoreOnStartupURLs = [ "files/title1.html" ] | 1407 // * RestoreOnStartupURLs = [ "files/title1.html" ] |
1408 policy_map_.Set(policy::key::kRestoreOnStartup, | 1408 policy_map_.Set( |
1409 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, | 1409 policy::key::kRestoreOnStartup, |
1410 base::Value::CreateIntegerValue( | 1410 policy::POLICY_LEVEL_MANDATORY, |
1411 SessionStartupPref::kPrefValueURLs), | 1411 policy::POLICY_SCOPE_USER, |
1412 NULL); | 1412 new base::FundamentalValue(SessionStartupPref::kPrefValueURLs), |
| 1413 NULL); |
1413 base::ListValue startup_urls; | 1414 base::ListValue startup_urls; |
1414 startup_urls.Append( | 1415 startup_urls.Append( |
1415 new base::StringValue(test_server()->GetURL("files/title1.html").spec())); | 1416 new base::StringValue(test_server()->GetURL("files/title1.html").spec())); |
1416 policy_map_.Set(policy::key::kRestoreOnStartupURLs, | 1417 policy_map_.Set(policy::key::kRestoreOnStartupURLs, |
1417 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, | 1418 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, |
1418 startup_urls.DeepCopy(), NULL); | 1419 startup_urls.DeepCopy(), NULL); |
1419 provider_.UpdateChromePolicy(policy_map_); | 1420 provider_.UpdateChromePolicy(policy_map_); |
1420 base::RunLoop().RunUntilIdle(); | 1421 base::RunLoop().RunUntilIdle(); |
1421 | 1422 |
1422 // Do a process-startup browser launch. | 1423 // Do a process-startup browser launch. |
(...skipping 13 matching lines...) Expand all Loading... |
1436 ASSERT_EQ(1, tab_strip->count()); | 1437 ASSERT_EQ(1, tab_strip->count()); |
1437 EXPECT_EQ("title1.html", | 1438 EXPECT_EQ("title1.html", |
1438 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 1439 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
1439 } | 1440 } |
1440 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1441 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
1441 | 1442 |
1442 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || | 1443 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || |
1443 // defined(ENABLE_CONFIGURATION_POLICY) | 1444 // defined(ENABLE_CONFIGURATION_POLICY) |
1444 | 1445 |
1445 #endif // !defined(OS_CHROMEOS) | 1446 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |