OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // Used by CloseWithAppMenuOpen. Invokes CloseWindow on the supplied browser. | 218 // Used by CloseWithAppMenuOpen. Invokes CloseWindow on the supplied browser. |
219 void CloseWindowCallback(Browser* browser) { | 219 void CloseWindowCallback(Browser* browser) { |
220 chrome::CloseWindow(browser); | 220 chrome::CloseWindow(browser); |
221 } | 221 } |
222 | 222 |
223 // Used by CloseWithAppMenuOpen. Posts a CloseWindowCallback and shows the app | 223 // Used by CloseWithAppMenuOpen. Posts a CloseWindowCallback and shows the app |
224 // menu. | 224 // menu. |
225 void RunCloseWithAppMenuCallback(Browser* browser) { | 225 void RunCloseWithAppMenuCallback(Browser* browser) { |
226 // ShowAppMenu is modal under views. Schedule a task that closes the window. | 226 // ShowAppMenu is modal under views. Schedule a task that closes the window. |
227 base::ThreadTaskRunnerHandle::Get()->PostTask( | 227 base::ThreadTaskRunnerHandle::Get()->PostTask( |
228 FROM_HERE, base::Bind(&CloseWindowCallback, browser)); | 228 FROM_HERE, base::BindOnce(&CloseWindowCallback, browser)); |
229 chrome::ShowAppMenu(browser); | 229 chrome::ShowAppMenu(browser); |
230 } | 230 } |
231 | 231 |
232 // Displays "INTERSTITIAL" while the interstitial is attached. | 232 // Displays "INTERSTITIAL" while the interstitial is attached. |
233 // (InterstitialPage can be used in a test directly, but there would be no way | 233 // (InterstitialPage can be used in a test directly, but there would be no way |
234 // to visually tell if it is showing or not.) | 234 // to visually tell if it is showing or not.) |
235 class TestInterstitialPage : public content::InterstitialPageDelegate { | 235 class TestInterstitialPage : public content::InterstitialPageDelegate { |
236 public: | 236 public: |
237 TestInterstitialPage(WebContents* tab, bool new_navigation, const GURL& url) { | 237 TestInterstitialPage(WebContents* tab, bool new_navigation, const GURL& url) { |
238 interstitial_page_ = InterstitialPage::Create( | 238 interstitial_page_ = InterstitialPage::Create( |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 #endif // !defined(OS_CHROMEOS) | 1507 #endif // !defined(OS_CHROMEOS) |
1508 | 1508 |
1509 // This test verifies we don't crash when closing the last window and the app | 1509 // This test verifies we don't crash when closing the last window and the app |
1510 // menu is showing. | 1510 // menu is showing. |
1511 IN_PROC_BROWSER_TEST_F(BrowserTest, CloseWithAppMenuOpen) { | 1511 IN_PROC_BROWSER_TEST_F(BrowserTest, CloseWithAppMenuOpen) { |
1512 if (browser_defaults::kBrowserAliveWithNoWindows) | 1512 if (browser_defaults::kBrowserAliveWithNoWindows) |
1513 return; | 1513 return; |
1514 | 1514 |
1515 // We need a message loop running for menus on windows. | 1515 // We need a message loop running for menus on windows. |
1516 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1516 base::ThreadTaskRunnerHandle::Get()->PostTask( |
1517 FROM_HERE, base::Bind(&RunCloseWithAppMenuCallback, browser())); | 1517 FROM_HERE, base::BindOnce(&RunCloseWithAppMenuCallback, browser())); |
1518 } | 1518 } |
1519 | 1519 |
1520 #if !defined(OS_MACOSX) | 1520 #if !defined(OS_MACOSX) |
1521 IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) { | 1521 IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) { |
1522 ASSERT_TRUE(embedded_test_server()->Start()); | 1522 ASSERT_TRUE(embedded_test_server()->Start()); |
1523 | 1523 |
1524 // Load an app | 1524 // Load an app |
1525 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 1525 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
1526 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 1526 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
1527 const Extension* extension_app = GetExtension(); | 1527 const Extension* extension_app = GetExtension(); |
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2874 Browser* browser = new Browser(params); | 2874 Browser* browser = new Browser(params); |
2875 gfx::Rect bounds = browser->window()->GetBounds(); | 2875 gfx::Rect bounds = browser->window()->GetBounds(); |
2876 | 2876 |
2877 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2877 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
2878 // See https://crbug.com/567925. | 2878 // See https://crbug.com/567925. |
2879 EXPECT_GE(bounds.width(), 100); | 2879 EXPECT_GE(bounds.width(), 100); |
2880 EXPECT_EQ(122, bounds.height()); | 2880 EXPECT_EQ(122, bounds.height()); |
2881 browser->window()->Close(); | 2881 browser->window()->Close(); |
2882 } | 2882 } |
2883 } | 2883 } |
OLD | NEW |