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/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #if defined(OS_MACOSX) | 10 #if defined(OS_MACOSX) |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 | 1368 |
1369 IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) { | 1369 IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) { |
1370 chrome::RegisterAppPrefs(L"Test"); | 1370 chrome::RegisterAppPrefs(L"Test"); |
1371 | 1371 |
1372 // We start with a normal browser with one tab. | 1372 // We start with a normal browser with one tab. |
1373 EXPECT_EQ(1, browser()->tab_count()); | 1373 EXPECT_EQ(1, browser()->tab_count()); |
1374 | 1374 |
1375 // Open a popup browser with a single blank foreground tab. | 1375 // Open a popup browser with a single blank foreground tab. |
1376 Browser* popup_browser = browser()->CreateWithParams( | 1376 Browser* popup_browser = browser()->CreateWithParams( |
1377 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); | 1377 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); |
1378 popup_browser->AddBlankTab(true); | 1378 chrome::AddBlankTab(popup_browser, true); |
1379 EXPECT_EQ(1, popup_browser->tab_count()); | 1379 EXPECT_EQ(1, popup_browser->tab_count()); |
1380 | 1380 |
1381 // Now try opening another tab in the popup browser. | 1381 // Now try opening another tab in the popup browser. |
1382 AddTabWithURLParams params1(url, content::PAGE_TRANSITION_TYPED); | 1382 AddTabWithURLParams params1(url, content::PAGE_TRANSITION_TYPED); |
1383 popup_browser->AddTabWithURL(¶ms1); | 1383 popup_browser->AddTabWithURL(¶ms1); |
1384 EXPECT_EQ(popup_browser, params1.target); | 1384 EXPECT_EQ(popup_browser, params1.target); |
1385 | 1385 |
1386 // The popup should still only have one tab. | 1386 // The popup should still only have one tab. |
1387 EXPECT_EQ(1, popup_browser->tab_count()); | 1387 EXPECT_EQ(1, popup_browser->tab_count()); |
1388 | 1388 |
1389 // The normal browser should now have two. | 1389 // The normal browser should now have two. |
1390 EXPECT_EQ(2, browser()->tab_count()); | 1390 EXPECT_EQ(2, browser()->tab_count()); |
1391 | 1391 |
1392 // Open an app frame browser with a single blank foreground tab. | 1392 // Open an app frame browser with a single blank foreground tab. |
1393 Browser* app_browser = browser()->CreateWithParams( | 1393 Browser* app_browser = browser()->CreateWithParams( |
1394 Browser::CreateParams::CreateForApp( | 1394 Browser::CreateParams::CreateForApp( |
1395 L"Test", browser()->profile(), false)); | 1395 L"Test", browser()->profile(), false)); |
1396 app_browser->AddBlankTab(true); | 1396 chrome::AddBlankTab(app_browser, true); |
1397 EXPECT_EQ(1, app_browser->tab_count()); | 1397 EXPECT_EQ(1, app_browser->tab_count()); |
1398 | 1398 |
1399 // Now try opening another tab in the app browser. | 1399 // Now try opening another tab in the app browser. |
1400 AddTabWithURLParams params2(GURL(chrome::kAboutBlankURL), | 1400 AddTabWithURLParams params2(GURL(chrome::kAboutBlankURL), |
1401 content::PAGE_TRANSITION_TYPED); | 1401 content::PAGE_TRANSITION_TYPED); |
1402 app_browser->AddTabWithURL(¶ms2); | 1402 app_browser->AddTabWithURL(¶ms2); |
1403 EXPECT_EQ(app_browser, params2.target); | 1403 EXPECT_EQ(app_browser, params2.target); |
1404 | 1404 |
1405 // The popup should still only have one tab. | 1405 // The popup should still only have one tab. |
1406 EXPECT_EQ(1, app_browser->tab_count()); | 1406 EXPECT_EQ(1, app_browser->tab_count()); |
1407 | 1407 |
1408 // The normal browser should now have three. | 1408 // The normal browser should now have three. |
1409 EXPECT_EQ(3, browser()->tab_count()); | 1409 EXPECT_EQ(3, browser()->tab_count()); |
1410 | 1410 |
1411 // Open an app frame popup browser with a single blank foreground tab. | 1411 // Open an app frame popup browser with a single blank foreground tab. |
1412 Browser* app_popup_browser = browser()->CreateWithParams( | 1412 Browser* app_popup_browser = browser()->CreateWithParams( |
1413 Browser::CreateParams::CreateForApp( | 1413 Browser::CreateParams::CreateForApp( |
1414 L"Test", browser()->profile(), false)); | 1414 L"Test", browser()->profile(), false)); |
1415 app_popup_browser->AddBlankTab(true); | 1415 chrome::AddBlankTab(app_popup_browser, true); |
1416 EXPECT_EQ(1, app_popup_browser->tab_count()); | 1416 EXPECT_EQ(1, app_popup_browser->tab_count()); |
1417 | 1417 |
1418 // Now try opening another tab in the app popup browser. | 1418 // Now try opening another tab in the app popup browser. |
1419 AddTabWithURLParams params3(GURL(chrome::kAboutBlankURL), | 1419 AddTabWithURLParams params3(GURL(chrome::kAboutBlankURL), |
1420 content::PAGE_TRANSITION_TYPED); | 1420 content::PAGE_TRANSITION_TYPED); |
1421 app_popup_browser->AddTabWithURL(¶ms3); | 1421 app_popup_browser->AddTabWithURL(¶ms3); |
1422 EXPECT_EQ(app_popup_browser, params3.target); | 1422 EXPECT_EQ(app_popup_browser, params3.target); |
1423 | 1423 |
1424 // The popup should still only have one tab. | 1424 // The popup should still only have one tab. |
1425 EXPECT_EQ(1, app_popup_browser->tab_count()); | 1425 EXPECT_EQ(1, app_popup_browser->tab_count()); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 command_line->AppendSwitchASCII(switches::kApp, url.spec()); | 1588 command_line->AppendSwitchASCII(switches::kApp, url.spec()); |
1589 } | 1589 } |
1590 }; | 1590 }; |
1591 | 1591 |
1592 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { | 1592 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { |
1593 // Test that an application browser window loads correctly. | 1593 // Test that an application browser window loads correctly. |
1594 | 1594 |
1595 // Verify the browser is in application mode. | 1595 // Verify the browser is in application mode. |
1596 EXPECT_TRUE(browser()->IsApplication()); | 1596 EXPECT_TRUE(browser()->IsApplication()); |
1597 } | 1597 } |
OLD | NEW |