| 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 "base/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "content/browser/download/download_manager_impl.h" | 7 #include "content/browser/download/download_manager_impl.h" |
| 8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 | 26 |
| 27 class ResourceDispatcherHostBrowserTest : public ContentBrowserTest, | 27 class ResourceDispatcherHostBrowserTest : public ContentBrowserTest, |
| 28 public DownloadManager::Observer { | 28 public DownloadManager::Observer { |
| 29 public: | 29 public: |
| 30 ResourceDispatcherHostBrowserTest() : got_downloads_(false) {} | 30 ResourceDispatcherHostBrowserTest() : got_downloads_(false) {} |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 virtual void SetUpOnMainThread() OVERRIDE { | 33 virtual void SetUpOnMainThread() OVERRIDE { |
| 34 FilePath path = GetTestFilePath("", ""); | 34 base::FilePath path = GetTestFilePath("", ""); |
| 35 BrowserThread::PostTask( | 35 BrowserThread::PostTask( |
| 36 BrowserThread::IO, FROM_HERE, | 36 BrowserThread::IO, FROM_HERE, |
| 37 base::Bind(&URLRequestMockHTTPJob::AddUrlHandler, path)); | 37 base::Bind(&URLRequestMockHTTPJob::AddUrlHandler, path)); |
| 38 BrowserThread::PostTask( | 38 BrowserThread::PostTask( |
| 39 BrowserThread::IO, FROM_HERE, | 39 BrowserThread::IO, FROM_HERE, |
| 40 base::Bind(&URLRequestFailedJob::AddUrlHandler)); | 40 base::Bind(&URLRequestFailedJob::AddUrlHandler)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual void OnDownloadCreated( | 43 virtual void OnDownloadCreated( |
| 44 DownloadManager* manager, | 44 DownloadManager* manager, |
| 45 DownloadItem* item) OVERRIDE { | 45 DownloadItem* item) OVERRIDE { |
| 46 if (!got_downloads_) | 46 if (!got_downloads_) |
| 47 got_downloads_ = !!manager->InProgressCount(); | 47 got_downloads_ = !!manager->InProgressCount(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 GURL GetMockURL(const std::string& file) { | 50 GURL GetMockURL(const std::string& file) { |
| 51 return URLRequestMockHTTPJob::GetMockUrl(FilePath().AppendASCII(file)); | 51 return URLRequestMockHTTPJob::GetMockUrl( |
| 52 base::FilePath().AppendASCII(file)); |
| 52 } | 53 } |
| 53 | 54 |
| 54 void CheckTitleTest(const GURL& url, | 55 void CheckTitleTest(const GURL& url, |
| 55 const std::string& expected_title) { | 56 const std::string& expected_title) { |
| 56 string16 expected_title16(ASCIIToUTF16(expected_title)); | 57 string16 expected_title16(ASCIIToUTF16(expected_title)); |
| 57 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); | 58 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); |
| 58 NavigateToURL(shell(), url); | 59 NavigateToURL(shell(), url); |
| 59 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); | 60 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); |
| 60 } | 61 } |
| 61 | 62 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 CrossSiteFailedRequest) { | 392 CrossSiteFailedRequest) { |
| 392 // Visit another URL first to trigger a cross-site navigation. | 393 // Visit another URL first to trigger a cross-site navigation. |
| 393 NavigateToURL(shell(), GetTestUrl("", "simple_page.html")); | 394 NavigateToURL(shell(), GetTestUrl("", "simple_page.html")); |
| 394 | 395 |
| 395 // Visit a URL that fails without calling ResourceDispatcherHost::Read. | 396 // Visit a URL that fails without calling ResourceDispatcherHost::Read. |
| 396 GURL broken_url("chrome://theme"); | 397 GURL broken_url("chrome://theme"); |
| 397 NavigateToURL(shell(), broken_url); | 398 NavigateToURL(shell(), broken_url); |
| 398 } | 399 } |
| 399 | 400 |
| 400 } // namespace content | 401 } // namespace content |
| OLD | NEW |