OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
9 #include "base/test/test_file_util.h" | 9 #include "base/test/test_file_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // Verify that the window is present. | 322 // Verify that the window is present. |
323 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 323 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
324 ASSERT_TRUE(browser.get()); | 324 ASSERT_TRUE(browser.get()); |
325 | 325 |
326 // Verify the browser is an application. | 326 // Verify the browser is an application. |
327 Browser::Type type; | 327 Browser::Type type; |
328 ASSERT_TRUE(browser->GetType(&type)); | 328 ASSERT_TRUE(browser->GetType(&type)); |
329 EXPECT_EQ(Browser::TYPE_APP, type); | 329 EXPECT_EQ(Browser::TYPE_APP, type); |
330 } | 330 } |
331 | 331 |
| 332 // Tests to ensure that the browser continues running in the background after |
| 333 // the last window closes. |
| 334 class RunInBackgroundTest : public UITest { |
| 335 public: |
| 336 RunInBackgroundTest() { |
| 337 launch_arguments_.AppendSwitch(switches::kKeepAliveForTest); |
| 338 } |
| 339 }; |
| 340 |
| 341 TEST_F(RunInBackgroundTest, RunInBackgroundBasicTest) { |
| 342 // Close the browser window, then open a new one - the browser should keep |
| 343 // running. |
| 344 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 345 ASSERT_TRUE(browser.get()); |
| 346 int window_count; |
| 347 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 348 EXPECT_EQ(1, window_count); |
| 349 ASSERT_TRUE(browser->RunCommand(IDC_CLOSE_WINDOW)); |
| 350 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 351 EXPECT_EQ(0, window_count); |
| 352 ASSERT_TRUE(IsBrowserRunning()); |
| 353 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, true)); |
| 354 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 355 EXPECT_EQ(1, window_count); |
| 356 } |
| 357 |
332 } // namespace | 358 } // namespace |
OLD | NEW |