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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2199 // Tests to ensure that the browser continues running in the background after | 2199 // Tests to ensure that the browser continues running in the background after |
2200 // the last window closes. | 2200 // the last window closes. |
2201 class NoStartupWindowTest : public BrowserTest { | 2201 class NoStartupWindowTest : public BrowserTest { |
2202 public: | 2202 public: |
2203 NoStartupWindowTest() {} | 2203 NoStartupWindowTest() {} |
2204 | 2204 |
2205 void SetUpCommandLine(CommandLine* command_line) override { | 2205 void SetUpCommandLine(CommandLine* command_line) override { |
2206 command_line->AppendSwitch(switches::kNoStartupWindow); | 2206 command_line->AppendSwitch(switches::kNoStartupWindow); |
2207 command_line->AppendSwitch(switches::kKeepAliveForTest); | 2207 command_line->AppendSwitch(switches::kKeepAliveForTest); |
2208 } | 2208 } |
| 2209 |
| 2210 // Returns true if any commands were processed. |
| 2211 bool ProcessedAnyCommands(BaseSessionService* base_session_service) { |
| 2212 return base_session_service->ProcessedAnyCommandsForTest(); |
| 2213 } |
2209 }; | 2214 }; |
2210 | 2215 |
2211 IN_PROC_BROWSER_TEST_F(NoStartupWindowTest, NoStartupWindowBasicTest) { | 2216 IN_PROC_BROWSER_TEST_F(NoStartupWindowTest, NoStartupWindowBasicTest) { |
2212 #if defined(OS_WIN) && defined(USE_ASH) | 2217 #if defined(OS_WIN) && defined(USE_ASH) |
2213 // kNoStartupWindow doesn't make sense in Metro+Ash. | 2218 // kNoStartupWindow doesn't make sense in Metro+Ash. |
2214 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 2219 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
2215 return; | 2220 return; |
2216 #endif | 2221 #endif |
2217 | 2222 |
2218 // No browser window should be started by default. | 2223 // No browser window should be started by default. |
(...skipping 14 matching lines...) Expand all Loading... |
2233 #if defined(OS_WIN) && defined(USE_ASH) | 2238 #if defined(OS_WIN) && defined(USE_ASH) |
2234 // kNoStartupWindow doesn't make sense in Metro+Ash. | 2239 // kNoStartupWindow doesn't make sense in Metro+Ash. |
2235 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 2240 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
2236 return; | 2241 return; |
2237 #endif | 2242 #endif |
2238 | 2243 |
2239 Profile* profile = ProfileManager::GetActiveUserProfile(); | 2244 Profile* profile = ProfileManager::GetActiveUserProfile(); |
2240 | 2245 |
2241 SessionService* session_service = | 2246 SessionService* session_service = |
2242 SessionServiceFactory::GetForProfile(profile); | 2247 SessionServiceFactory::GetForProfile(profile); |
2243 ASSERT_FALSE(session_service->processed_any_commands()); | 2248 BaseSessionService* base_session_service = |
| 2249 session_service->GetBaseSessionServiceForTest(); |
| 2250 ASSERT_FALSE(ProcessedAnyCommands(base_session_service)); |
2244 | 2251 |
2245 ui_test_utils::BrowserAddedObserver browser_added_observer; | 2252 ui_test_utils::BrowserAddedObserver browser_added_observer; |
2246 CreateBrowserForApp("blah", profile); | 2253 CreateBrowserForApp("blah", profile); |
2247 browser_added_observer.WaitForSingleNewBrowser(); | 2254 browser_added_observer.WaitForSingleNewBrowser(); |
2248 | 2255 |
2249 ASSERT_FALSE(session_service->processed_any_commands()); | 2256 ASSERT_FALSE(ProcessedAnyCommands(base_session_service)); |
2250 } | 2257 } |
2251 #endif // !defined(OS_CHROMEOS) | 2258 #endif // !defined(OS_CHROMEOS) |
2252 | 2259 |
2253 // This test needs to be placed outside the anonymous namespace because we | 2260 // This test needs to be placed outside the anonymous namespace because we |
2254 // need to access private type of Browser. | 2261 // need to access private type of Browser. |
2255 class AppModeTest : public BrowserTest { | 2262 class AppModeTest : public BrowserTest { |
2256 public: | 2263 public: |
2257 AppModeTest() {} | 2264 AppModeTest() {} |
2258 | 2265 |
2259 void SetUpCommandLine(CommandLine* command_line) override { | 2266 void SetUpCommandLine(CommandLine* command_line) override { |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2641 #endif | 2648 #endif |
2642 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2649 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
2643 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2650 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
2644 gfx::Size exp_final_size(initial_wcv_size); | 2651 gfx::Size exp_final_size(initial_wcv_size); |
2645 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2652 exp_final_size.Enlarge(wcv_resize_insets.width(), |
2646 wcv_resize_insets.height() + height_inset); | 2653 wcv_resize_insets.height() + height_inset); |
2647 EXPECT_EQ(exp_final_size, | 2654 EXPECT_EQ(exp_final_size, |
2648 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2655 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
2649 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); | 2656 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); |
2650 } | 2657 } |
OLD | NEW |