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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 base::CommandLine* command_line) { | 895 base::CommandLine* command_line) { |
896 command_line->AppendSwitch(switches::kForceFirstRun); | 896 command_line->AppendSwitch(switches::kForceFirstRun); |
897 } | 897 } |
898 | 898 |
899 void StartupBrowserCreatorFirstRunTest::SetUpInProcessBrowserTestFixture() { | 899 void StartupBrowserCreatorFirstRunTest::SetUpInProcessBrowserTestFixture() { |
900 #if defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) | 900 #if defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) |
901 // Set a policy that prevents the first-run dialog from being shown. | 901 // Set a policy that prevents the first-run dialog from being shown. |
902 policy_map_.Set(policy::key::kMetricsReportingEnabled, | 902 policy_map_.Set(policy::key::kMetricsReportingEnabled, |
903 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, | 903 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, |
904 policy::POLICY_SOURCE_CLOUD, | 904 policy::POLICY_SOURCE_CLOUD, |
905 base::MakeUnique<base::FundamentalValue>(false), nullptr); | 905 base::MakeUnique<base::Value>(false), nullptr); |
906 provider_.UpdateChromePolicy(policy_map_); | 906 provider_.UpdateChromePolicy(policy_map_); |
907 #endif // defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) | 907 #endif // defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) |
908 | 908 |
909 EXPECT_CALL(provider_, IsInitializationComplete(_)) | 909 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
910 .WillRepeatedly(Return(true)); | 910 .WillRepeatedly(Return(true)); |
911 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | 911 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
912 } | 912 } |
913 | 913 |
914 // http://crbug.com/691707 | 914 // http://crbug.com/691707 |
915 #if defined(OS_MACOSX) | 915 #if defined(OS_MACOSX) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 StartupBrowserCreator browser_creator; | 964 StartupBrowserCreator browser_creator; |
965 | 965 |
966 DisableWelcomePages({browser()->profile()}); | 966 DisableWelcomePages({browser()->profile()}); |
967 | 967 |
968 // Set the following user policies: | 968 // Set the following user policies: |
969 // * RestoreOnStartup = RestoreOnStartupIsURLs | 969 // * RestoreOnStartup = RestoreOnStartupIsURLs |
970 // * RestoreOnStartupURLs = [ "/title1.html" ] | 970 // * RestoreOnStartupURLs = [ "/title1.html" ] |
971 policy_map_.Set( | 971 policy_map_.Set( |
972 policy::key::kRestoreOnStartup, policy::POLICY_LEVEL_MANDATORY, | 972 policy::key::kRestoreOnStartup, policy::POLICY_LEVEL_MANDATORY, |
973 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, | 973 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, |
974 base::WrapUnique( | 974 base::WrapUnique(new base::Value(SessionStartupPref::kPrefValueURLs)), |
975 new base::FundamentalValue(SessionStartupPref::kPrefValueURLs)), | |
976 nullptr); | 975 nullptr); |
977 base::ListValue startup_urls; | 976 base::ListValue startup_urls; |
978 startup_urls.AppendString( | 977 startup_urls.AppendString( |
979 embedded_test_server()->GetURL("/title1.html").spec()); | 978 embedded_test_server()->GetURL("/title1.html").spec()); |
980 policy_map_.Set(policy::key::kRestoreOnStartupURLs, | 979 policy_map_.Set(policy::key::kRestoreOnStartupURLs, |
981 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, | 980 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, |
982 policy::POLICY_SOURCE_CLOUD, startup_urls.CreateDeepCopy(), | 981 policy::POLICY_SOURCE_CLOUD, startup_urls.CreateDeepCopy(), |
983 nullptr); | 982 nullptr); |
984 provider_.UpdateChromePolicy(policy_map_); | 983 provider_.UpdateChromePolicy(policy_map_); |
985 base::RunLoop().RunUntilIdle(); | 984 base::RunLoop().RunUntilIdle(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 ASSERT_TRUE(browser); | 1100 ASSERT_TRUE(browser); |
1102 tab_strip = browser->tab_strip_model(); | 1101 tab_strip = browser->tab_strip_model(); |
1103 | 1102 |
1104 // Ensure that the new tab page appears on subsequent runs. | 1103 // Ensure that the new tab page appears on subsequent runs. |
1105 ASSERT_EQ(1, tab_strip->count()); | 1104 ASSERT_EQ(1, tab_strip->count()); |
1106 EXPECT_EQ("chrome://newtab/", | 1105 EXPECT_EQ("chrome://newtab/", |
1107 tab_strip->GetWebContentsAt(0)->GetURL().possibly_invalid_spec()); | 1106 tab_strip->GetWebContentsAt(0)->GetURL().possibly_invalid_spec()); |
1108 } | 1107 } |
1109 | 1108 |
1110 #endif // !defined(OS_CHROMEOS) | 1109 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |