| 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 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "chrome/browser/ui/browser_commands.h" | 46 #include "chrome/browser/ui/browser_commands.h" |
| 47 #include "chrome/browser/ui/browser_list.h" | 47 #include "chrome/browser/ui/browser_list.h" |
| 48 #include "chrome/browser/ui/browser_tabstrip.h" | 48 #include "chrome/browser/ui/browser_tabstrip.h" |
| 49 #include "chrome/browser/ui/browser_window.h" | 49 #include "chrome/browser/ui/browser_window.h" |
| 50 #include "chrome/browser/ui/omnibox/location_bar.h" | 50 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 51 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 51 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
| 52 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 52 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 53 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 53 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 54 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 54 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 55 #include "chrome/common/chrome_notification_types.h" | 55 #include "chrome/common/chrome_notification_types.h" |
| 56 #include "chrome/common/chrome_switches.h" |
| 56 #include "chrome/common/content_settings.h" | 57 #include "chrome/common/content_settings.h" |
| 57 #include "chrome/common/extensions/extension.h" | 58 #include "chrome/common/extensions/extension.h" |
| 58 #include "chrome/common/extensions/extension_constants.h" | 59 #include "chrome/common/extensions/extension_constants.h" |
| 59 #include "chrome/common/pref_names.h" | 60 #include "chrome/common/pref_names.h" |
| 60 #include "chrome/common/url_constants.h" | 61 #include "chrome/common/url_constants.h" |
| 61 #include "chrome/test/base/in_process_browser_test.h" | 62 #include "chrome/test/base/in_process_browser_test.h" |
| 62 #include "chrome/test/base/ui_test_utils.h" | 63 #include "chrome/test/base/ui_test_utils.h" |
| 63 #include "content/public/browser/browser_child_process_host_iterator.h" | 64 #include "content/public/browser/browser_child_process_host_iterator.h" |
| 64 #include "content/public/browser/browser_context.h" | 65 #include "content/public/browser/browser_context.h" |
| 65 #include "content/public/browser/browser_thread.h" | 66 #include "content/public/browser/browser_thread.h" |
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 // created. Each test parameter is a method that sets up the early policies | 1202 // created. Each test parameter is a method that sets up the early policies |
| 1202 // and stores the expected startup URLs in |expected_urls_|. | 1203 // and stores the expected startup URLs in |expected_urls_|. |
| 1203 class RestoreOnStartupPolicyTest | 1204 class RestoreOnStartupPolicyTest |
| 1204 : public PolicyTest, | 1205 : public PolicyTest, |
| 1205 public testing::WithParamInterface< | 1206 public testing::WithParamInterface< |
| 1206 void (RestoreOnStartupPolicyTest::*)(void)> { | 1207 void (RestoreOnStartupPolicyTest::*)(void)> { |
| 1207 public: | 1208 public: |
| 1208 RestoreOnStartupPolicyTest() {} | 1209 RestoreOnStartupPolicyTest() {} |
| 1209 virtual ~RestoreOnStartupPolicyTest() {} | 1210 virtual ~RestoreOnStartupPolicyTest() {} |
| 1210 | 1211 |
| 1212 #if defined(OS_CHROMEOS) |
| 1213 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 1214 // TODO(nkostylev): Investigate if we can remove this switch. |
| 1215 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests); |
| 1216 PolicyTest::SetUpCommandLine(command_line); |
| 1217 } |
| 1218 #endif |
| 1219 |
| 1211 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 1220 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 1212 PolicyTest::SetUpInProcessBrowserTestFixture(); | 1221 PolicyTest::SetUpInProcessBrowserTestFixture(); |
| 1213 // Set early policies now, before the browser is created. | 1222 // Set early policies now, before the browser is created. |
| 1214 (this->*(GetParam()))(); | 1223 (this->*(GetParam()))(); |
| 1215 | 1224 |
| 1216 // Remove the non-switch arguments, so that session restore kicks in for | 1225 // Remove the non-switch arguments, so that session restore kicks in for |
| 1217 // these tests. | 1226 // these tests. |
| 1218 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1227 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1219 CommandLine::StringVector argv = command_line->argv(); | 1228 CommandLine::StringVector argv = command_line->argv(); |
| 1220 argv.erase(std::remove_if(++argv.begin(), argv.end(), IsNonSwitchArgument), | 1229 argv.erase(std::remove_if(++argv.begin(), argv.end(), IsNonSwitchArgument), |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 INSTANTIATE_TEST_CASE_P( | 1338 INSTANTIATE_TEST_CASE_P( |
| 1330 RestoreOnStartupPolicyTestInstance, | 1339 RestoreOnStartupPolicyTestInstance, |
| 1331 RestoreOnStartupPolicyTest, | 1340 RestoreOnStartupPolicyTest, |
| 1332 testing::Values(&RestoreOnStartupPolicyTest::HomepageIsNotNTP, | 1341 testing::Values(&RestoreOnStartupPolicyTest::HomepageIsNotNTP, |
| 1333 &RestoreOnStartupPolicyTest::HomepageIsNTP, | 1342 &RestoreOnStartupPolicyTest::HomepageIsNTP, |
| 1334 &RestoreOnStartupPolicyTest::ListOfURLs, | 1343 &RestoreOnStartupPolicyTest::ListOfURLs, |
| 1335 &RestoreOnStartupPolicyTest::NTP, | 1344 &RestoreOnStartupPolicyTest::NTP, |
| 1336 &RestoreOnStartupPolicyTest::Last)); | 1345 &RestoreOnStartupPolicyTest::Last)); |
| 1337 | 1346 |
| 1338 } // namespace policy | 1347 } // namespace policy |
| OLD | NEW |