| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 33 #include "chrome/test/base/in_process_browser_test.h" | 33 #include "chrome/test/base/in_process_browser_test.h" |
| 34 #include "chrome/test/base/ui_test_utils.h" | 34 #include "chrome/test/base/ui_test_utils.h" |
| 35 #include "content/public/browser/download_item.h" | 35 #include "content/public/browser/download_item.h" |
| 36 #include "content/public/browser/download_manager.h" | 36 #include "content/public/browser/download_manager.h" |
| 37 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
| 38 #include "content/public/browser/notification_types.h" | 38 #include "content/public/browser/notification_types.h" |
| 39 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
| 40 #include "content/public/test/test_utils.h" | 40 #include "content/public/test/test_utils.h" |
| 41 #include "content/test/net/url_request_mock_http_job.h" | 41 #include "net/test/url_request/url_request_mock_http_job.h" |
| 42 #include "testing/gtest/include/gtest/gtest.h" | 42 #include "testing/gtest/include/gtest/gtest.h" |
| 43 | 43 |
| 44 using content::BrowserContext; | 44 using content::BrowserContext; |
| 45 using content::BrowserThread; | 45 using content::BrowserThread; |
| 46 using content::DownloadItem; | 46 using content::DownloadItem; |
| 47 using content::DownloadManager; | 47 using content::DownloadManager; |
| 48 using content::URLRequestMockHTTPJob; | |
| 49 using content::WebContents; | 48 using content::WebContents; |
| 49 using net::URLRequestMockHTTPJob; |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 // Waits for an item record in the downloads database to match |filter|. See | 53 // Waits for an item record in the downloads database to match |filter|. See |
| 54 // DownloadStoredProperly() below for an example filter. | 54 // DownloadStoredProperly() below for an example filter. |
| 55 class DownloadPersistedObserver : public DownloadHistory::Observer { | 55 class DownloadPersistedObserver : public DownloadHistory::Observer { |
| 56 public: | 56 public: |
| 57 typedef base::Callback<bool( | 57 typedef base::Callback<bool( |
| 58 DownloadItem* item, | 58 DownloadItem* item, |
| 59 const history::DownloadRow&)> PersistedFilter; | 59 const history::DownloadRow&)> PersistedFilter; |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 base::FilePath download_dir = DownloadPrefs::FromDownloadManager( | 800 base::FilePath download_dir = DownloadPrefs::FromDownloadManager( |
| 801 GetDownloadManager())->DownloadPath(); | 801 GetDownloadManager())->DownloadPath(); |
| 802 base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); | 802 base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); |
| 803 ASSERT_TRUE(base::PathExists(filename)); | 803 ASSERT_TRUE(base::PathExists(filename)); |
| 804 std::string contents; | 804 std::string contents; |
| 805 EXPECT_TRUE(base::ReadFileToString(filename, &contents)); | 805 EXPECT_TRUE(base::ReadFileToString(filename, &contents)); |
| 806 EXPECT_EQ("foo", contents); | 806 EXPECT_EQ("foo", contents); |
| 807 } | 807 } |
| 808 | 808 |
| 809 } // namespace | 809 } // namespace |
| OLD | NEW |