| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "grit/generated_resources.h" | 55 #include "grit/generated_resources.h" |
| 56 #include "net/base/mock_host_resolver.h" | 56 #include "net/base/mock_host_resolver.h" |
| 57 #include "net/test/test_server.h" | 57 #include "net/test/test_server.h" |
| 58 #include "ui/base/l10n/l10n_util.h" | 58 #include "ui/base/l10n/l10n_util.h" |
| 59 | 59 |
| 60 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
| 61 #include "base/i18n/rtl.h" | 61 #include "base/i18n/rtl.h" |
| 62 #include "chrome/browser/browser_process.h" | 62 #include "chrome/browser/browser_process.h" |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 using content::NavigationEntry; |
| 65 using content::OpenURLParams; | 66 using content::OpenURLParams; |
| 66 using content::Referrer; | 67 using content::Referrer; |
| 67 using content::WebContents; | 68 using content::WebContents; |
| 68 | 69 |
| 69 namespace { | 70 namespace { |
| 70 | 71 |
| 71 const char* kBeforeUnloadHTML = | 72 const char* kBeforeUnloadHTML = |
| 72 "<html><head><title>beforeunload</title></head><body>" | 73 "<html><head><title>beforeunload</title></head><body>" |
| 73 "<script>window.onbeforeunload=function(e){return 'foo'}</script>" | 74 "<script>window.onbeforeunload=function(e){return 'foo'}</script>" |
| 74 "</body></html>"; | 75 "</body></html>"; |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 // Test RenderView correctly send back favicon url for web page that redirects | 662 // Test RenderView correctly send back favicon url for web page that redirects |
| 662 // to an anchor in javascript body.onload handler. | 663 // to an anchor in javascript body.onload handler. |
| 663 IN_PROC_BROWSER_TEST_F(BrowserTest, | 664 IN_PROC_BROWSER_TEST_F(BrowserTest, |
| 664 DISABLED_FaviconOfOnloadRedirectToAnchorPage) { | 665 DISABLED_FaviconOfOnloadRedirectToAnchorPage) { |
| 665 ASSERT_TRUE(test_server()->Start()); | 666 ASSERT_TRUE(test_server()->Start()); |
| 666 GURL url(test_server()->GetURL("files/onload_redirect_to_anchor.html")); | 667 GURL url(test_server()->GetURL("files/onload_redirect_to_anchor.html")); |
| 667 GURL expected_favicon_url(test_server()->GetURL("files/test.png")); | 668 GURL expected_favicon_url(test_server()->GetURL("files/test.png")); |
| 668 | 669 |
| 669 ui_test_utils::NavigateToURL(browser(), url); | 670 ui_test_utils::NavigateToURL(browser(), url); |
| 670 | 671 |
| 671 content::NavigationEntry* entry = browser()->GetSelectedTabContents()-> | 672 NavigationEntry* entry = browser()->GetSelectedTabContents()-> |
| 672 GetController().GetActiveEntry(); | 673 GetController().GetActiveEntry(); |
| 673 EXPECT_EQ(expected_favicon_url.spec(), entry->GetFavicon().url.spec()); | 674 EXPECT_EQ(expected_favicon_url.spec(), entry->GetFavicon().url.spec()); |
| 674 } | 675 } |
| 675 | 676 |
| 676 #if defined(OS_MACOSX) || defined(OS_LINUX) | 677 #if defined(OS_MACOSX) || defined(OS_LINUX) |
| 677 // http://crbug.com/83828. On Mac 10.6, the failure rate is 14% | 678 // http://crbug.com/83828. On Mac 10.6, the failure rate is 14% |
| 678 #define MAYBE_FaviconChange FLAKY_FaviconChange | 679 #define MAYBE_FaviconChange FLAKY_FaviconChange |
| 679 #else | 680 #else |
| 680 #define MAYBE_FaviconChange FaviconChange | 681 #define MAYBE_FaviconChange FaviconChange |
| 681 #endif | 682 #endif |
| 682 // Test that an icon can be changed from JS. | 683 // Test that an icon can be changed from JS. |
| 683 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_FaviconChange) { | 684 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_FaviconChange) { |
| 684 static const FilePath::CharType* kFile = | 685 static const FilePath::CharType* kFile = |
| 685 FILE_PATH_LITERAL("onload_change_favicon.html"); | 686 FILE_PATH_LITERAL("onload_change_favicon.html"); |
| 686 GURL file_url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), | 687 GURL file_url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), |
| 687 FilePath(kFile))); | 688 FilePath(kFile))); |
| 688 ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme)); | 689 ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme)); |
| 689 ui_test_utils::NavigateToURL(browser(), file_url); | 690 ui_test_utils::NavigateToURL(browser(), file_url); |
| 690 | 691 |
| 691 content::NavigationEntry* entry = browser()->GetSelectedTabContents()-> | 692 NavigationEntry* entry = browser()->GetSelectedTabContents()-> |
| 692 GetController().GetActiveEntry(); | 693 GetController().GetActiveEntry(); |
| 693 static const FilePath::CharType* kIcon = | 694 static const FilePath::CharType* kIcon = |
| 694 FILE_PATH_LITERAL("test1.png"); | 695 FILE_PATH_LITERAL("test1.png"); |
| 695 GURL expected_favicon_url( | 696 GURL expected_favicon_url( |
| 696 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), | 697 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), |
| 697 FilePath(kIcon))); | 698 FilePath(kIcon))); |
| 698 EXPECT_EQ(expected_favicon_url.spec(), entry->GetFavicon().url.spec()); | 699 EXPECT_EQ(expected_favicon_url.spec(), entry->GetFavicon().url.spec()); |
| 699 } | 700 } |
| 700 | 701 |
| 701 // Makes sure TabClosing is sent when uninstalling an extension that is an app | 702 // Makes sure TabClosing is sent when uninstalling an extension that is an app |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 | 1458 |
| 1458 // The normal browser should now have four. | 1459 // The normal browser should now have four. |
| 1459 EXPECT_EQ(4, browser()->tab_count()); | 1460 EXPECT_EQ(4, browser()->tab_count()); |
| 1460 | 1461 |
| 1461 // Close the additional browsers. | 1462 // Close the additional browsers. |
| 1462 popup_browser->CloseAllTabs(); | 1463 popup_browser->CloseAllTabs(); |
| 1463 app_browser->CloseAllTabs(); | 1464 app_browser->CloseAllTabs(); |
| 1464 app_popup_browser->CloseAllTabs(); | 1465 app_popup_browser->CloseAllTabs(); |
| 1465 } | 1466 } |
| 1466 #endif | 1467 #endif |
| OLD | NEW |