Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Side by Side Diff: content/browser/download/download_manager_impl_unittest.cc

Issue 10492009: Move test headers from content\test to content\public\test. This way we can enforce that internal c… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 10 matching lines...) Expand all
21 #include "content/browser/download/download_file_impl.h" 21 #include "content/browser/download/download_file_impl.h"
22 #include "content/browser/download/download_file_manager.h" 22 #include "content/browser/download/download_file_manager.h"
23 #include "content/browser/download/download_manager_impl.h" 23 #include "content/browser/download/download_manager_impl.h"
24 #include "content/browser/download/download_request_handle.h" 24 #include "content/browser/download/download_request_handle.h"
25 #include "content/browser/download/mock_download_file.h" 25 #include "content/browser/download/mock_download_file.h"
26 #include "content/browser/power_save_blocker.h" 26 #include "content/browser/power_save_blocker.h"
27 #include "content/public/browser/download_interrupt_reasons.h" 27 #include "content/public/browser/download_interrupt_reasons.h"
28 #include "content/public/browser/download_item.h" 28 #include "content/public/browser/download_item.h"
29 #include "content/public/browser/download_manager_delegate.h" 29 #include "content/public/browser/download_manager_delegate.h"
30 #include "content/public/test/mock_download_manager.h" 30 #include "content/public/test/mock_download_manager.h"
31 #include "content/test/test_browser_context.h" 31 #include "content/public/test/test_browser_context.h"
32 #include "content/test/test_browser_thread.h" 32 #include "content/test/test_browser_thread.h"
33 #include "net/base/io_buffer.h" 33 #include "net/base/io_buffer.h"
34 #include "net/base/net_util.h" 34 #include "net/base/net_util.h"
35 #include "testing/gmock/include/gmock/gmock.h" 35 #include "testing/gmock/include/gmock/gmock.h"
36 #include "testing/gmock_mutant.h" 36 #include "testing/gmock_mutant.h"
37 #include "testing/gtest/include/gtest/gtest.h" 37 #include "testing/gtest/include/gtest/gtest.h"
38 38
39 #if defined(USE_AURA) && defined(OS_WIN) 39 #if defined(USE_AURA) && defined(OS_WIN)
40 // http://crbug.com/105200 40 // http://crbug.com/105200
41 #define MAYBE_StartDownload DISABLED_StartDownload 41 #define MAYBE_StartDownload DISABLED_StartDownload
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 }; 249 };
250 250
251 } // namespace 251 } // namespace
252 252
253 class DownloadManagerTest : public testing::Test { 253 class DownloadManagerTest : public testing::Test {
254 public: 254 public:
255 static const char* kTestData; 255 static const char* kTestData;
256 static const size_t kTestDataLen; 256 static const size_t kTestDataLen;
257 257
258 DownloadManagerTest() 258 DownloadManagerTest()
259 : browser_context(new TestBrowserContext()), 259 : browser_context(new content::TestBrowserContext()),
260 download_manager_delegate_(new TestDownloadManagerDelegate()), 260 download_manager_delegate_(new TestDownloadManagerDelegate()),
261 download_manager_(new DownloadManagerImpl( 261 download_manager_(new DownloadManagerImpl(
262 download_manager_delegate_.get(), NULL)), 262 download_manager_delegate_.get(), NULL)),
263 ui_thread_(BrowserThread::UI, &message_loop_), 263 ui_thread_(BrowserThread::UI, &message_loop_),
264 file_thread_(BrowserThread::FILE, &message_loop_), 264 file_thread_(BrowserThread::FILE, &message_loop_),
265 download_buffer_(new content::DownloadBuffer) { 265 download_buffer_(new content::DownloadBuffer) {
266 download_manager_->Init(browser_context.get()); 266 download_manager_->Init(browser_context.get());
267 download_manager_delegate_->set_download_manager(download_manager_); 267 download_manager_delegate_->set_download_manager(download_manager_);
268 } 268 }
269 269
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 return download_manager_->GetActiveDownload(id); 342 return download_manager_->GetActiveDownload(id);
343 } 343 }
344 344
345 FilePath GetPathInDownloadsDir(const FilePath::StringType& fragment) { 345 FilePath GetPathInDownloadsDir(const FilePath::StringType& fragment) {
346 DCHECK(scoped_download_dir_.IsValid()); 346 DCHECK(scoped_download_dir_.IsValid());
347 FilePath full_path(scoped_download_dir_.path().Append(fragment)); 347 FilePath full_path(scoped_download_dir_.path().Append(fragment));
348 return full_path.NormalizePathSeparators(); 348 return full_path.NormalizePathSeparators();
349 } 349 }
350 350
351 protected: 351 protected:
352 scoped_ptr<TestBrowserContext> browser_context; 352 scoped_ptr<content::TestBrowserContext> browser_context;
353 scoped_ptr<TestDownloadManagerDelegate> download_manager_delegate_; 353 scoped_ptr<TestDownloadManagerDelegate> download_manager_delegate_;
354 scoped_refptr<DownloadManagerImpl> download_manager_; 354 scoped_refptr<DownloadManagerImpl> download_manager_;
355 scoped_refptr<DownloadFileManager> file_manager_; 355 scoped_refptr<DownloadFileManager> file_manager_;
356 MessageLoopForUI message_loop_; 356 MessageLoopForUI message_loop_;
357 content::TestBrowserThread ui_thread_; 357 content::TestBrowserThread ui_thread_;
358 content::TestBrowserThread file_thread_; 358 content::TestBrowserThread file_thread_;
359 scoped_refptr<content::DownloadBuffer> download_buffer_; 359 scoped_refptr<content::DownloadBuffer> download_buffer_;
360 ScopedTempDir scoped_download_dir_; 360 ScopedTempDir scoped_download_dir_;
361 361
362 DownloadFileManager* file_manager() { 362 DownloadFileManager* file_manager() {
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED)); 1258 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED));
1259 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE)); 1259 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE));
1260 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); 1260 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING));
1261 EXPECT_TRUE(observer->was_updated()); 1261 EXPECT_TRUE(observer->was_updated());
1262 EXPECT_FALSE(observer->was_opened()); 1262 EXPECT_FALSE(observer->was_opened());
1263 EXPECT_TRUE(download->GetFileExternallyRemoved()); 1263 EXPECT_TRUE(download->GetFileExternallyRemoved());
1264 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); 1264 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState());
1265 1265
1266 EXPECT_FALSE(file_util::PathExists(new_path)); 1266 EXPECT_FALSE(file_util::PathExists(new_path));
1267 } 1267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698