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/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "content/browser/download/download_file_factory.h" | 8 #include "content/browser/download/download_file_factory.h" |
9 #include "content/browser/download/download_file_impl.h" | 9 #include "content/browser/download/download_file_impl.h" |
10 #include "content/browser/download/download_item_impl.h" | 10 #include "content/browser/download/download_item_impl.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 DISALLOW_COPY_AND_ASSIGN(MockDownloadFileObserver); | 45 DISALLOW_COPY_AND_ASSIGN(MockDownloadFileObserver); |
46 }; | 46 }; |
47 | 47 |
48 class DragDownloadFileTest : public ContentBrowserTest { | 48 class DragDownloadFileTest : public ContentBrowserTest { |
49 public: | 49 public: |
50 DragDownloadFileTest() {} | 50 DragDownloadFileTest() {} |
51 ~DragDownloadFileTest() override {} | 51 ~DragDownloadFileTest() override {} |
52 | 52 |
53 void Succeed() { | 53 void Succeed() { |
54 BrowserThread::PostTask(BrowserThread::UI, | 54 BrowserThread::PostTask( |
55 FROM_HERE, | 55 BrowserThread::UI, FROM_HERE, |
56 base::MessageLoopForUI::current()->QuitClosure()); | 56 base::MessageLoopForUI::current()->QuitWhenIdleClosure()); |
57 } | 57 } |
58 | 58 |
59 void FailFast() { | 59 void FailFast() { |
60 CHECK(false); | 60 CHECK(false); |
61 } | 61 } |
62 | 62 |
63 protected: | 63 protected: |
64 void SetUpOnMainThread() override { | 64 void SetUpOnMainThread() override { |
65 ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir()); | 65 ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir()); |
66 ShellDownloadManagerDelegate* delegate = | 66 ShellDownloadManagerDelegate* delegate = |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 .WillOnce(InvokeWithoutArgs(this, &DragDownloadFileTest::Succeed)); | 126 .WillOnce(InvokeWithoutArgs(this, &DragDownloadFileTest::Succeed)); |
127 ON_CALL(*observer.get(), OnDownloadAborted()) | 127 ON_CALL(*observer.get(), OnDownloadAborted()) |
128 .WillByDefault(InvokeWithoutArgs(this, &DragDownloadFileTest::FailFast)); | 128 .WillByDefault(InvokeWithoutArgs(this, &DragDownloadFileTest::FailFast)); |
129 file->Start(observer.get()); | 129 file->Start(observer.get()); |
130 RunMessageLoop(); | 130 RunMessageLoop(); |
131 } | 131 } |
132 | 132 |
133 // TODO(benjhayden): Test Stop(). | 133 // TODO(benjhayden): Test Stop(). |
134 | 134 |
135 } // namespace content | 135 } // namespace content |
OLD | NEW |