| 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 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 | 1472 |
| 1473 IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) { | 1473 IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) { |
| 1474 chrome::RegisterAppPrefs(L"Test"); | 1474 chrome::RegisterAppPrefs(L"Test"); |
| 1475 | 1475 |
| 1476 // We start with a normal browser with one tab. | 1476 // We start with a normal browser with one tab. |
| 1477 EXPECT_EQ(1, browser()->tab_count()); | 1477 EXPECT_EQ(1, browser()->tab_count()); |
| 1478 | 1478 |
| 1479 // Open a popup browser with a single blank foreground tab. | 1479 // Open a popup browser with a single blank foreground tab. |
| 1480 Browser* popup_browser = new Browser( | 1480 Browser* popup_browser = new Browser( |
| 1481 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); | 1481 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); |
| 1482 chrome::AddBlankTab(popup_browser, true); | 1482 chrome::AddBlankTabAt(popup_browser, -1, true); |
| 1483 EXPECT_EQ(1, popup_browser->tab_count()); | 1483 EXPECT_EQ(1, popup_browser->tab_count()); |
| 1484 | 1484 |
| 1485 // Now try opening another tab in the popup browser. | 1485 // Now try opening another tab in the popup browser. |
| 1486 AddTabWithURLParams params1(url, content::PAGE_TRANSITION_TYPED); | 1486 AddTabWithURLParams params1(url, content::PAGE_TRANSITION_TYPED); |
| 1487 popup_browser->AddTabWithURL(¶ms1); | 1487 popup_browser->AddTabWithURL(¶ms1); |
| 1488 EXPECT_EQ(popup_browser, params1.target); | 1488 EXPECT_EQ(popup_browser, params1.target); |
| 1489 | 1489 |
| 1490 // The popup should still only have one tab. | 1490 // The popup should still only have one tab. |
| 1491 EXPECT_EQ(1, popup_browser->tab_count()); | 1491 EXPECT_EQ(1, popup_browser->tab_count()); |
| 1492 | 1492 |
| 1493 // The normal browser should now have two. | 1493 // The normal browser should now have two. |
| 1494 EXPECT_EQ(2, browser()->tab_count()); | 1494 EXPECT_EQ(2, browser()->tab_count()); |
| 1495 | 1495 |
| 1496 // Open an app frame browser with a single blank foreground tab. | 1496 // Open an app frame browser with a single blank foreground tab. |
| 1497 Browser* app_browser = new Browser(Browser::CreateParams::CreateForApp( | 1497 Browser* app_browser = new Browser(Browser::CreateParams::CreateForApp( |
| 1498 L"Test", browser()->profile(), false)); | 1498 L"Test", browser()->profile(), false)); |
| 1499 chrome::AddBlankTab(app_browser, true); | 1499 chrome::AddBlankTabAt(app_browser, -1, true); |
| 1500 EXPECT_EQ(1, app_browser->tab_count()); | 1500 EXPECT_EQ(1, app_browser->tab_count()); |
| 1501 | 1501 |
| 1502 // Now try opening another tab in the app browser. | 1502 // Now try opening another tab in the app browser. |
| 1503 AddTabWithURLParams params2(GURL(chrome::kAboutBlankURL), | 1503 AddTabWithURLParams params2(GURL(chrome::kAboutBlankURL), |
| 1504 content::PAGE_TRANSITION_TYPED); | 1504 content::PAGE_TRANSITION_TYPED); |
| 1505 app_browser->AddTabWithURL(¶ms2); | 1505 app_browser->AddTabWithURL(¶ms2); |
| 1506 EXPECT_EQ(app_browser, params2.target); | 1506 EXPECT_EQ(app_browser, params2.target); |
| 1507 | 1507 |
| 1508 // The popup should still only have one tab. | 1508 // The popup should still only have one tab. |
| 1509 EXPECT_EQ(1, app_browser->tab_count()); | 1509 EXPECT_EQ(1, app_browser->tab_count()); |
| 1510 | 1510 |
| 1511 // The normal browser should now have three. | 1511 // The normal browser should now have three. |
| 1512 EXPECT_EQ(3, browser()->tab_count()); | 1512 EXPECT_EQ(3, browser()->tab_count()); |
| 1513 | 1513 |
| 1514 // Open an app frame popup browser with a single blank foreground tab. | 1514 // Open an app frame popup browser with a single blank foreground tab. |
| 1515 Browser* app_popup_browser = new Browser(Browser::CreateParams::CreateForApp( | 1515 Browser* app_popup_browser = new Browser(Browser::CreateParams::CreateForApp( |
| 1516 L"Test", browser()->profile(), false)); | 1516 L"Test", browser()->profile(), false)); |
| 1517 chrome::AddBlankTab(app_popup_browser, true); | 1517 chrome::AddBlankTabAt(app_popup_browser, -1, true); |
| 1518 EXPECT_EQ(1, app_popup_browser->tab_count()); | 1518 EXPECT_EQ(1, app_popup_browser->tab_count()); |
| 1519 | 1519 |
| 1520 // Now try opening another tab in the app popup browser. | 1520 // Now try opening another tab in the app popup browser. |
| 1521 AddTabWithURLParams params3(GURL(chrome::kAboutBlankURL), | 1521 AddTabWithURLParams params3(GURL(chrome::kAboutBlankURL), |
| 1522 content::PAGE_TRANSITION_TYPED); | 1522 content::PAGE_TRANSITION_TYPED); |
| 1523 app_popup_browser->AddTabWithURL(¶ms3); | 1523 app_popup_browser->AddTabWithURL(¶ms3); |
| 1524 EXPECT_EQ(app_popup_browser, params3.target); | 1524 EXPECT_EQ(app_popup_browser, params3.target); |
| 1525 | 1525 |
| 1526 // The popup should still only have one tab. | 1526 // The popup should still only have one tab. |
| 1527 EXPECT_EQ(1, app_popup_browser->tab_count()); | 1527 EXPECT_EQ(1, app_popup_browser->tab_count()); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); | 1930 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); |
| 1931 } | 1931 } |
| 1932 | 1932 |
| 1933 // Shift-middle-clicks open in a foreground tab. | 1933 // Shift-middle-clicks open in a foreground tab. |
| 1934 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefShiftMiddleClickTest) { | 1934 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefShiftMiddleClickTest) { |
| 1935 int modifiers = WebKit::WebInputEvent::ShiftKey; | 1935 int modifiers = WebKit::WebInputEvent::ShiftKey; |
| 1936 WebKit::WebMouseEvent::Button button = WebKit::WebMouseEvent::ButtonMiddle; | 1936 WebKit::WebMouseEvent::Button button = WebKit::WebMouseEvent::ButtonMiddle; |
| 1937 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; | 1937 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; |
| 1938 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); | 1938 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); |
| 1939 } | 1939 } |
| OLD | NEW |