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/auto_reset.h" | 5 #include "base/auto_reset.h" |
| 6 #include "base/files/scoped_temp_dir.h" |
6 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
7 #include "base/scoped_temp_dir.h" | |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/webui/downloads_dom_handler.h" | 12 #include "chrome/browser/ui/webui/downloads_dom_handler.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
16 #include "content/public/browser/download_persistent_store_info.h" | 16 #include "content/public/browser/download_persistent_store_info.h" |
17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 prefs::kDownloadDefaultDirectory, | 120 prefs::kDownloadDefaultDirectory, |
121 downloads_directory_.path()); | 121 downloads_directory_.path()); |
122 CHECK(test_server()->Start()); | 122 CHECK(test_server()->Start()); |
123 } | 123 } |
124 | 124 |
125 content::DownloadManager* download_manager() { | 125 content::DownloadManager* download_manager() { |
126 return content::BrowserContext::GetDownloadManager(browser()->profile()); | 126 return content::BrowserContext::GetDownloadManager(browser()->profile()); |
127 } | 127 } |
128 | 128 |
129 private: | 129 private: |
130 ScopedTempDir downloads_directory_; | 130 base::ScopedTempDir downloads_directory_; |
131 | 131 |
132 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandlerTest); | 132 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandlerTest); |
133 }; | 133 }; |
134 | 134 |
135 // Tests that DownloadsDOMHandler detects new downloads and relays them to the | 135 // Tests that DownloadsDOMHandler detects new downloads and relays them to the |
136 // renderer. | 136 // renderer. |
137 // crbug.com/159390: This test fails when daylight savings time ends. | 137 // crbug.com/159390: This test fails when daylight savings time ends. |
138 IN_PROC_BROWSER_TEST_F(DownloadsDOMHandlerTest, | 138 IN_PROC_BROWSER_TEST_F(DownloadsDOMHandlerTest, |
139 DownloadsDOMHandlerTest_Created) { | 139 DownloadsDOMHandlerTest_Created) { |
140 MockDownloadsDOMHandler mddh(download_manager()); | 140 MockDownloadsDOMHandler mddh(download_manager()); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // TODO(benjhayden): Test incognito, both downloads_list() and that on-record | 189 // TODO(benjhayden): Test incognito, both downloads_list() and that on-record |
190 // calls can't access off-record items. | 190 // calls can't access off-record items. |
191 | 191 |
192 // TODO(benjhayden): Test that bad download ids incoming from the javascript are | 192 // TODO(benjhayden): Test that bad download ids incoming from the javascript are |
193 // dropped on the floor. | 193 // dropped on the floor. |
194 | 194 |
195 // TODO(benjhayden): Test that IsTemporary() downloads are not shown. | 195 // TODO(benjhayden): Test that IsTemporary() downloads are not shown. |
196 | 196 |
197 // TODO(benjhayden): Test that RemoveObserver is called on all download items, | 197 // TODO(benjhayden): Test that RemoveObserver is called on all download items, |
198 // including items that crossed IsTemporary() and back. | 198 // including items that crossed IsTemporary() and back. |
OLD | NEW |