| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 if (*it != browser) | 82 if (*it != browser) |
| 83 other_browser = *it; | 83 other_browser = *it; |
| 84 } | 84 } |
| 85 return other_browser; | 85 return other_browser; |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace | 88 } // namespace |
| 89 | 89 |
| 90 class StartupBrowserCreatorTest : public ExtensionBrowserTest { | 90 class StartupBrowserCreatorTest : public ExtensionBrowserTest { |
| 91 protected: | 91 protected: |
| 92 virtual bool SetUpUserDataDirectory() OVERRIDE { | 92 virtual bool SetUpUserDataDirectory() override { |
| 93 return ExtensionBrowserTest::SetUpUserDataDirectory(); | 93 return ExtensionBrowserTest::SetUpUserDataDirectory(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 96 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 97 ExtensionBrowserTest::SetUpCommandLine(command_line); | 97 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 98 command_line->AppendSwitch(switches::kEnablePanels); | 98 command_line->AppendSwitch(switches::kEnablePanels); |
| 99 command_line->AppendSwitchASCII(switches::kHomePage, url::kAboutBlankURL); | 99 command_line->AppendSwitchASCII(switches::kHomePage, url::kAboutBlankURL); |
| 100 #if defined(OS_CHROMEOS) | 100 #if defined(OS_CHROMEOS) |
| 101 // TODO(nkostylev): Investigate if we can remove this switch. | 101 // TODO(nkostylev): Investigate if we can remove this switch. |
| 102 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests); | 102 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests); |
| 103 #endif | 103 #endif |
| 104 } | 104 } |
| 105 | 105 |
| 106 // Helper functions return void so that we can ASSERT*(). | 106 // Helper functions return void so that we can ASSERT*(). |
| (...skipping 28 matching lines...) Expand all Loading... |
| 135 return *it; | 135 return *it; |
| 136 } | 136 } |
| 137 return NULL; | 137 return NULL; |
| 138 } | 138 } |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 class OpenURLsPopupObserver : public chrome::BrowserListObserver { | 141 class OpenURLsPopupObserver : public chrome::BrowserListObserver { |
| 142 public: | 142 public: |
| 143 OpenURLsPopupObserver() : added_browser_(NULL) { } | 143 OpenURLsPopupObserver() : added_browser_(NULL) { } |
| 144 | 144 |
| 145 virtual void OnBrowserAdded(Browser* browser) OVERRIDE { | 145 virtual void OnBrowserAdded(Browser* browser) override { |
| 146 added_browser_ = browser; | 146 added_browser_ = browser; |
| 147 } | 147 } |
| 148 | 148 |
| 149 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE { } | 149 virtual void OnBrowserRemoved(Browser* browser) override { } |
| 150 | 150 |
| 151 Browser* added_browser_; | 151 Browser* added_browser_; |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 // Test that when there is a popup as the active browser any requests to | 154 // Test that when there is a popup as the active browser any requests to |
| 155 // StartupBrowserCreatorImpl::OpenURLsInBrowser don't crash because there's no | 155 // StartupBrowserCreatorImpl::OpenURLsInBrowser don't crash because there's no |
| 156 // explicit profile given. | 156 // explicit profile given. |
| 157 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenURLsPopup) { | 157 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenURLsPopup) { |
| 158 std::vector<GURL> urls; | 158 std::vector<GURL> urls; |
| 159 urls.push_back(GURL("http://localhost")); | 159 urls.push_back(GURL("http://localhost")); |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 tab_strip = new_browser->tab_strip_model(); | 996 tab_strip = new_browser->tab_strip_model(); |
| 997 ASSERT_EQ(1, tab_strip->count()); | 997 ASSERT_EQ(1, tab_strip->count()); |
| 998 web_contents = tab_strip->GetWebContentsAt(0); | 998 web_contents = tab_strip->GetWebContentsAt(0); |
| 999 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | 999 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); |
| 1000 infobar_service = InfoBarService::FromWebContents(web_contents); | 1000 infobar_service = InfoBarService::FromWebContents(web_contents); |
| 1001 EXPECT_EQ(1U, infobar_service->infobar_count()); | 1001 EXPECT_EQ(1U, infobar_service->infobar_count()); |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 class SupervisedUserBrowserCreatorTest : public InProcessBrowserTest { | 1004 class SupervisedUserBrowserCreatorTest : public InProcessBrowserTest { |
| 1005 protected: | 1005 protected: |
| 1006 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 1006 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 1007 InProcessBrowserTest::SetUpCommandLine(command_line); | 1007 InProcessBrowserTest::SetUpCommandLine(command_line); |
| 1008 command_line->AppendSwitchASCII(switches::kSupervisedUserId, "asdf"); | 1008 command_line->AppendSwitchASCII(switches::kSupervisedUserId, "asdf"); |
| 1009 } | 1009 } |
| 1010 }; | 1010 }; |
| 1011 | 1011 |
| 1012 IN_PROC_BROWSER_TEST_F(SupervisedUserBrowserCreatorTest, | 1012 IN_PROC_BROWSER_TEST_F(SupervisedUserBrowserCreatorTest, |
| 1013 StartupSupervisedUserProfile) { | 1013 StartupSupervisedUserProfile) { |
| 1014 StartupBrowserCreator browser_creator; | 1014 StartupBrowserCreator browser_creator; |
| 1015 | 1015 |
| 1016 // Do a simple non-process-startup browser launch. | 1016 // Do a simple non-process-startup browser launch. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1038 // the sync promo exist there. | 1038 // the sync promo exist there. |
| 1039 #if !defined(OS_CHROMEOS) | 1039 #if !defined(OS_CHROMEOS) |
| 1040 | 1040 |
| 1041 // On a branded Linux build, policy is required to suppress the first-run | 1041 // On a branded Linux build, policy is required to suppress the first-run |
| 1042 // dialog. | 1042 // dialog. |
| 1043 #if !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || \ | 1043 #if !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || \ |
| 1044 defined(ENABLE_CONFIGURATION_POLICY) | 1044 defined(ENABLE_CONFIGURATION_POLICY) |
| 1045 | 1045 |
| 1046 class StartupBrowserCreatorFirstRunTest : public InProcessBrowserTest { | 1046 class StartupBrowserCreatorFirstRunTest : public InProcessBrowserTest { |
| 1047 protected: | 1047 protected: |
| 1048 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 1048 virtual void SetUpCommandLine(CommandLine* command_line) override; |
| 1049 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; | 1049 virtual void SetUpInProcessBrowserTestFixture() override; |
| 1050 | 1050 |
| 1051 #if defined(ENABLE_CONFIGURATION_POLICY) | 1051 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 1052 policy::MockConfigurationPolicyProvider provider_; | 1052 policy::MockConfigurationPolicyProvider provider_; |
| 1053 policy::PolicyMap policy_map_; | 1053 policy::PolicyMap policy_map_; |
| 1054 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1054 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| 1055 }; | 1055 }; |
| 1056 | 1056 |
| 1057 void StartupBrowserCreatorFirstRunTest::SetUpCommandLine( | 1057 void StartupBrowserCreatorFirstRunTest::SetUpCommandLine( |
| 1058 CommandLine* command_line) { | 1058 CommandLine* command_line) { |
| 1059 command_line->AppendSwitch(switches::kForceFirstRun); | 1059 command_line->AppendSwitch(switches::kForceFirstRun); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 ASSERT_EQ(1, tab_strip->count()); | 1440 ASSERT_EQ(1, tab_strip->count()); |
| 1441 EXPECT_EQ("title1.html", | 1441 EXPECT_EQ("title1.html", |
| 1442 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 1442 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
| 1443 } | 1443 } |
| 1444 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1444 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| 1445 | 1445 |
| 1446 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || | 1446 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || |
| 1447 // defined(ENABLE_CONFIGURATION_POLICY) | 1447 // defined(ENABLE_CONFIGURATION_POLICY) |
| 1448 | 1448 |
| 1449 #endif // !defined(OS_CHROMEOS) | 1449 #endif // !defined(OS_CHROMEOS) |
| OLD | NEW |