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/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/browser/download/download_manager_impl.h" | 9 #include "content/browser/download/download_manager_impl.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 using base::ASCIIToUTF16; | 29 using base::ASCIIToUTF16; |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 | 32 |
33 class ResourceDispatcherHostBrowserTest : public ContentBrowserTest, | 33 class ResourceDispatcherHostBrowserTest : public ContentBrowserTest, |
34 public DownloadManager::Observer { | 34 public DownloadManager::Observer { |
35 public: | 35 public: |
36 ResourceDispatcherHostBrowserTest() : got_downloads_(false) {} | 36 ResourceDispatcherHostBrowserTest() : got_downloads_(false) {} |
37 | 37 |
38 protected: | 38 protected: |
39 virtual void SetUpOnMainThread() OVERRIDE { | 39 virtual void SetUpOnMainThread() override { |
40 base::FilePath path = GetTestFilePath("", ""); | 40 base::FilePath path = GetTestFilePath("", ""); |
41 BrowserThread::PostTask( | 41 BrowserThread::PostTask( |
42 BrowserThread::IO, | 42 BrowserThread::IO, |
43 FROM_HERE, | 43 FROM_HERE, |
44 base::Bind( | 44 base::Bind( |
45 &net::URLRequestMockHTTPJob::AddUrlHandler, | 45 &net::URLRequestMockHTTPJob::AddUrlHandler, |
46 path, | 46 path, |
47 make_scoped_refptr(content::BrowserThread::GetBlockingPool()))); | 47 make_scoped_refptr(content::BrowserThread::GetBlockingPool()))); |
48 BrowserThread::PostTask( | 48 BrowserThread::PostTask( |
49 BrowserThread::IO, FROM_HERE, | 49 BrowserThread::IO, FROM_HERE, |
50 base::Bind(&net::URLRequestFailedJob::AddUrlHandler)); | 50 base::Bind(&net::URLRequestFailedJob::AddUrlHandler)); |
51 } | 51 } |
52 | 52 |
53 virtual void OnDownloadCreated( | 53 virtual void OnDownloadCreated( |
54 DownloadManager* manager, | 54 DownloadManager* manager, |
55 DownloadItem* item) OVERRIDE { | 55 DownloadItem* item) override { |
56 if (!got_downloads_) | 56 if (!got_downloads_) |
57 got_downloads_ = !!manager->InProgressCount(); | 57 got_downloads_ = !!manager->InProgressCount(); |
58 } | 58 } |
59 | 59 |
60 GURL GetMockURL(const std::string& file) { | 60 GURL GetMockURL(const std::string& file) { |
61 return net::URLRequestMockHTTPJob::GetMockUrl( | 61 return net::URLRequestMockHTTPJob::GetMockUrl( |
62 base::FilePath().AppendASCII(file)); | 62 base::FilePath().AppendASCII(file)); |
63 } | 63 } |
64 | 64 |
65 void CheckTitleTest(const GURL& url, | 65 void CheckTitleTest(const GURL& url, |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 "http://localhost:%d/set_cookie.html", embedded_test_server()->port())); | 466 "http://localhost:%d/set_cookie.html", embedded_test_server()->port())); |
467 GURL url(embedded_test_server()->GetURL("/redirect?" + set_cookie_url)); | 467 GURL url(embedded_test_server()->GetURL("/redirect?" + set_cookie_url)); |
468 | 468 |
469 ShellContentBrowserClient::SetSwapProcessesForRedirect(true); | 469 ShellContentBrowserClient::SetSwapProcessesForRedirect(true); |
470 ShellNetworkDelegate::SetAcceptAllCookies(false); | 470 ShellNetworkDelegate::SetAcceptAllCookies(false); |
471 | 471 |
472 CheckTitleTest(url, "cookie set"); | 472 CheckTitleTest(url, "cookie set"); |
473 } | 473 } |
474 | 474 |
475 } // namespace content | 475 } // namespace content |
OLD | NEW |