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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "content/browser/byte_stream.h" | 9 #include "content/browser/byte_stream.h" |
10 #include "content/browser/download/download_create_info.h" | 10 #include "content/browser/download/download_create_info.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 void RunAllPendingInMessageLoops() { | 319 void RunAllPendingInMessageLoops() { |
320 loop_.RunUntilIdle(); | 320 loop_.RunUntilIdle(); |
321 } | 321 } |
322 | 322 |
323 MockDelegate* mock_delegate() { | 323 MockDelegate* mock_delegate() { |
324 return &delegate_; | 324 return &delegate_; |
325 } | 325 } |
326 | 326 |
327 private: | 327 private: |
328 MessageLoopForUI loop_; | 328 base::MessageLoopForUI loop_; |
329 TestBrowserThread ui_thread_; // UI thread | 329 TestBrowserThread ui_thread_; // UI thread |
330 TestBrowserThread file_thread_; // FILE thread | 330 TestBrowserThread file_thread_; // FILE thread |
331 StrictMock<MockDelegate> delegate_; | 331 StrictMock<MockDelegate> delegate_; |
332 std::set<DownloadItem*> allocated_downloads_; | 332 std::set<DownloadItem*> allocated_downloads_; |
333 }; | 333 }; |
334 | 334 |
335 // Tests to ensure calls that change a DownloadItem generate an update to | 335 // Tests to ensure calls that change a DownloadItem generate an update to |
336 // observers. | 336 // observers. |
337 // State changing functions not tested: | 337 // State changing functions not tested: |
338 // void OpenDownload(); | 338 // void OpenDownload(); |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 EXPECT_CALL(*download_file, Detach()); | 1071 EXPECT_CALL(*download_file, Detach()); |
1072 RunAllPendingInMessageLoops(); | 1072 RunAllPendingInMessageLoops(); |
1073 EXPECT_EQ(DownloadItem::COMPLETE, item->GetState()); | 1073 EXPECT_EQ(DownloadItem::COMPLETE, item->GetState()); |
1074 } | 1074 } |
1075 | 1075 |
1076 TEST(MockDownloadItem, Compiles) { | 1076 TEST(MockDownloadItem, Compiles) { |
1077 MockDownloadItem mock_item; | 1077 MockDownloadItem mock_item; |
1078 } | 1078 } |
1079 | 1079 |
1080 } // namespace content | 1080 } // namespace content |
OLD | NEW |