| 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/ref_counted.h" | 7 #include "base/ref_counted.h" |
| 8 #include "chrome/browser/download/download_manager.h" | 8 #include "chrome/browser/download/download_manager.h" |
| 9 #include "chrome/browser/extensions/extension_error_reporter.h" | 9 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/renderer_host/site_instance.h" | |
| 12 #include "chrome/browser/tab_contents/tab_contents.h" | |
| 13 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
| 15 #include "chrome/common/notification_details.h" | 13 #include "chrome/common/notification_details.h" |
| 16 #include "chrome/common/notification_observer.h" | 14 #include "chrome/common/notification_observer.h" |
| 17 #include "chrome/common/notification_registrar.h" | 15 #include "chrome/common/notification_registrar.h" |
| 18 #include "chrome/common/notification_type.h" | 16 #include "chrome/common/notification_type.h" |
| 19 #include "chrome/test/in_process_browser_test.h" | 17 #include "chrome/test/in_process_browser_test.h" |
| 20 #include "chrome/test/ui_test_utils.h" | 18 #include "chrome/test/ui_test_utils.h" |
| 19 #include "content/browser/tab_contents/tab_contents.h" |
| 20 #include "content/browser/site_instance.h" |
| 21 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
| 22 #include "net/test/test_server.h" | 22 #include "net/test/test_server.h" |
| 23 | 23 |
| 24 class RenderViewHostManagerTest : public InProcessBrowserTest { | 24 class RenderViewHostManagerTest : public InProcessBrowserTest { |
| 25 public: | 25 public: |
| 26 RenderViewHostManagerTest() { | 26 RenderViewHostManagerTest() { |
| 27 EnableDOMAutomation(); | 27 EnableDOMAutomation(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 static bool GetFilePathWithHostAndPortReplacement( | 30 static bool GetFilePathWithHostAndPortReplacement( |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // Should have the same SiteInstance. | 181 // Should have the same SiteInstance. |
| 182 scoped_refptr<SiteInstance> noref_site_instance( | 182 scoped_refptr<SiteInstance> noref_site_instance( |
| 183 browser()->GetSelectedTabContents()->GetSiteInstance()); | 183 browser()->GetSelectedTabContents()->GetSiteInstance()); |
| 184 EXPECT_EQ(orig_site_instance, noref_site_instance); | 184 EXPECT_EQ(orig_site_instance, noref_site_instance); |
| 185 } | 185 } |
| 186 | 186 |
| 187 // Hangs flakily in Win, http://crbug.com/45040. | 187 // Hangs flakily in Win, http://crbug.com/45040. |
| 188 #if defined(OS_WIN) | 188 #if defined(OS_WIN) |
| 189 #define MAYBE_ChromeURLAfterDownload DISABLED_ChromeURLAfterDownload | 189 #define MAYBE_ChromeURLAfterDownload DISABLED_ChromeURLAfterDownload |
| 190 #else | 190 #else |
| 191 #defne MAYBE_ChromeURLAfterDownload ChromeURLAfterDownload | 191 #define MAYBE_ChromeURLAfterDownload ChromeURLAfterDownload |
| 192 #endif // defined(OS_WIN) | 192 #endif // defined(OS_WIN) |
| 193 | 193 |
| 194 // Test for crbug.com/14505. This tests that chrome:// urls are still functional | 194 // Test for crbug.com/14505. This tests that chrome:// urls are still functional |
| 195 // after download of a file while viewing another chrome://. | 195 // after download of a file while viewing another chrome://. |
| 196 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 196 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 197 MAYBE_ChromeURLAfterDownload) { | 197 MAYBE_ChromeURLAfterDownload) { |
| 198 GURL downloads_url("chrome://downloads"); | 198 GURL downloads_url("chrome://downloads"); |
| 199 GURL extensions_url("chrome://extensions"); | 199 GURL extensions_url("chrome://extensions"); |
| 200 FilePath zip_download; | 200 FilePath zip_download; |
| 201 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &zip_download)); | 201 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &zip_download)); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 &result)); | 268 &result)); |
| 269 EXPECT_TRUE(result); | 269 EXPECT_TRUE(result); |
| 270 ui_test_utils::NavigateToURL(browser(), zip_url); | 270 ui_test_utils::NavigateToURL(browser(), zip_url); |
| 271 | 271 |
| 272 ui_test_utils::WaitForDownloadCount( | 272 ui_test_utils::WaitForDownloadCount( |
| 273 browser()->profile()->GetDownloadManager(), 1); | 273 browser()->profile()->GetDownloadManager(), 1); |
| 274 | 274 |
| 275 browser()->CloseWindow(); | 275 browser()->CloseWindow(); |
| 276 BrowserClosedObserver wait_for_close(browser()); | 276 BrowserClosedObserver wait_for_close(browser()); |
| 277 } | 277 } |
| OLD | NEW |