| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "content/public/browser/notification_service.h" | 55 #include "content/public/browser/notification_service.h" |
| 56 #include "content/public/browser/notification_source.h" | 56 #include "content/public/browser/notification_source.h" |
| 57 #include "content/public/browser/render_process_host.h" | 57 #include "content/public/browser/render_process_host.h" |
| 58 #include "content/public/browser/render_view_host.h" | 58 #include "content/public/browser/render_view_host.h" |
| 59 #include "content/public/browser/render_widget_host_view.h" | 59 #include "content/public/browser/render_widget_host_view.h" |
| 60 #include "content/public/browser/web_contents.h" | 60 #include "content/public/browser/web_contents.h" |
| 61 #include "content/public/browser/web_contents_observer.h" | 61 #include "content/public/browser/web_contents_observer.h" |
| 62 #include "content/public/common/page_transition_types.h" | 62 #include "content/public/common/page_transition_types.h" |
| 63 #include "content/public/common/renderer_preferences.h" | 63 #include "content/public/common/renderer_preferences.h" |
| 64 #include "content/public/common/url_constants.h" | 64 #include "content/public/common/url_constants.h" |
| 65 #include "content/public/test/browser_test_utils.h" |
| 65 #include "grit/chromium_strings.h" | 66 #include "grit/chromium_strings.h" |
| 66 #include "grit/generated_resources.h" | 67 #include "grit/generated_resources.h" |
| 67 #include "net/base/mock_host_resolver.h" | 68 #include "net/base/mock_host_resolver.h" |
| 68 #include "net/test/test_server.h" | 69 #include "net/test/test_server.h" |
| 69 #include "ui/base/l10n/l10n_util.h" | 70 #include "ui/base/l10n/l10n_util.h" |
| 70 | 71 |
| 71 #if defined(OS_WIN) | 72 #if defined(OS_WIN) |
| 72 #include "base/i18n/rtl.h" | 73 #include "base/i18n/rtl.h" |
| 73 #include "chrome/browser/browser_process.h" | 74 #include "chrome/browser/browser_process.h" |
| 74 #endif | 75 #endif |
| (...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 chrome::CloseAllTabs(app_browser); | 1430 chrome::CloseAllTabs(app_browser); |
| 1430 chrome::CloseAllTabs(app_popup_browser); | 1431 chrome::CloseAllTabs(app_popup_browser); |
| 1431 } | 1432 } |
| 1432 #endif | 1433 #endif |
| 1433 | 1434 |
| 1434 IN_PROC_BROWSER_TEST_F(BrowserTest, WindowOpenClose) { | 1435 IN_PROC_BROWSER_TEST_F(BrowserTest, WindowOpenClose) { |
| 1435 GURL url = ui_test_utils::GetTestUrl( | 1436 GURL url = ui_test_utils::GetTestUrl( |
| 1436 FilePath(), FilePath().AppendASCII("window.close.html")); | 1437 FilePath(), FilePath().AppendASCII("window.close.html")); |
| 1437 | 1438 |
| 1438 string16 title = ASCIIToUTF16("Title Of Awesomeness"); | 1439 string16 title = ASCIIToUTF16("Title Of Awesomeness"); |
| 1439 ui_test_utils::TitleWatcher title_watcher( | 1440 content::TitleWatcher title_watcher( |
| 1440 chrome::GetActiveWebContents(browser()), title); | 1441 chrome::GetActiveWebContents(browser()), title); |
| 1441 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2); | 1442 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2); |
| 1442 EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); | 1443 EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); |
| 1443 } | 1444 } |
| 1444 | 1445 |
| 1445 class ShowModalDialogTest : public BrowserTest { | 1446 class ShowModalDialogTest : public BrowserTest { |
| 1446 public: | 1447 public: |
| 1447 ShowModalDialogTest() {} | 1448 ShowModalDialogTest() {} |
| 1448 | 1449 |
| 1449 virtual void SetUpCommandLine(CommandLine* command_line) { | 1450 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 1450 command_line->AppendSwitch(switches::kDisablePopupBlocking); | 1451 command_line->AppendSwitch(switches::kDisablePopupBlocking); |
| 1451 } | 1452 } |
| 1452 }; | 1453 }; |
| 1453 | 1454 |
| 1454 IN_PROC_BROWSER_TEST_F(ShowModalDialogTest, BasicTest) { | 1455 IN_PROC_BROWSER_TEST_F(ShowModalDialogTest, BasicTest) { |
| 1455 // This navigation should show a modal dialog that will be immediately | 1456 // This navigation should show a modal dialog that will be immediately |
| 1456 // closed, but the fact that it was shown should be recorded. | 1457 // closed, but the fact that it was shown should be recorded. |
| 1457 GURL url = ui_test_utils::GetTestUrl( | 1458 GURL url = ui_test_utils::GetTestUrl( |
| 1458 FilePath(), FilePath().AppendASCII("showmodaldialog.html")); | 1459 FilePath(), FilePath().AppendASCII("showmodaldialog.html")); |
| 1459 | 1460 |
| 1460 string16 expected_title(ASCIIToUTF16("SUCCESS")); | 1461 string16 expected_title(ASCIIToUTF16("SUCCESS")); |
| 1461 ui_test_utils::TitleWatcher title_watcher( | 1462 content::TitleWatcher title_watcher( |
| 1462 chrome::GetActiveWebContents(browser()), expected_title); | 1463 chrome::GetActiveWebContents(browser()), expected_title); |
| 1463 ui_test_utils::NavigateToURL(browser(), url); | 1464 ui_test_utils::NavigateToURL(browser(), url); |
| 1464 | 1465 |
| 1465 // Verify that we set a mark on successful dialog show. | 1466 // Verify that we set a mark on successful dialog show. |
| 1466 ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 1467 ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
| 1467 } | 1468 } |
| 1468 | 1469 |
| 1469 IN_PROC_BROWSER_TEST_F(BrowserTest, DisallowFileUrlUniversalAccessTest) { | 1470 IN_PROC_BROWSER_TEST_F(BrowserTest, DisallowFileUrlUniversalAccessTest) { |
| 1470 GURL url = ui_test_utils::GetTestUrl( | 1471 GURL url = ui_test_utils::GetTestUrl( |
| 1471 FilePath(), FilePath().AppendASCII("fileurl_universalaccess.html")); | 1472 FilePath(), FilePath().AppendASCII("fileurl_universalaccess.html")); |
| 1472 | 1473 |
| 1473 string16 expected_title(ASCIIToUTF16("Disallowed")); | 1474 string16 expected_title(ASCIIToUTF16("Disallowed")); |
| 1474 ui_test_utils::TitleWatcher title_watcher( | 1475 content::TitleWatcher title_watcher( |
| 1475 chrome::GetActiveWebContents(browser()), expected_title); | 1476 chrome::GetActiveWebContents(browser()), expected_title); |
| 1476 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("Allowed")); | 1477 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("Allowed")); |
| 1477 ui_test_utils::NavigateToURL(browser(), url); | 1478 ui_test_utils::NavigateToURL(browser(), url); |
| 1478 ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 1479 ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
| 1479 } | 1480 } |
| 1480 | 1481 |
| 1481 class KioskModeTest : public BrowserTest { | 1482 class KioskModeTest : public BrowserTest { |
| 1482 public: | 1483 public: |
| 1483 KioskModeTest() {} | 1484 KioskModeTest() {} |
| 1484 | 1485 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 command_line->AppendSwitchASCII(switches::kApp, url.spec()); | 1586 command_line->AppendSwitchASCII(switches::kApp, url.spec()); |
| 1586 } | 1587 } |
| 1587 }; | 1588 }; |
| 1588 | 1589 |
| 1589 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { | 1590 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { |
| 1590 // Test that an application browser window loads correctly. | 1591 // Test that an application browser window loads correctly. |
| 1591 | 1592 |
| 1592 // Verify the browser is in application mode. | 1593 // Verify the browser is in application mode. |
| 1593 EXPECT_TRUE(browser()->IsApplication()); | 1594 EXPECT_TRUE(browser()->IsApplication()); |
| 1594 } | 1595 } |
| OLD | NEW |