| 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 // Disable everything on windows only. http://crbug.com/306144 | 5 // Disable everything on windows only. http://crbug.com/306144 |
| 6 #ifndef OS_WIN | 6 #ifndef OS_WIN |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 // Wait for that to finish. | 725 // Wait for that to finish. |
| 726 done_event.Wait(); | 726 done_event.Wait(); |
| 727 base::DeleteFile(temp_file, false); | 727 base::DeleteFile(temp_file, false); |
| 728 return result; | 728 return result; |
| 729 } | 729 } |
| 730 | 730 |
| 731 private: | 731 private: |
| 732 static void CopyInCompletion(bool* result, | 732 static void CopyInCompletion(bool* result, |
| 733 base::WaitableEvent* done_event, | 733 base::WaitableEvent* done_event, |
| 734 base::File::Error error) { | 734 base::File::Error error) { |
| 735 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 735 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 736 *result = error == base::File::FILE_OK; | 736 *result = error == base::File::FILE_OK; |
| 737 done_event->Signal(); | 737 done_event->Signal(); |
| 738 } | 738 } |
| 739 | 739 |
| 740 static void CreateFileForTestingOnIOThread( | 740 static void CreateFileForTestingOnIOThread( |
| 741 fileapi::FileSystemContext* context, | 741 fileapi::FileSystemContext* context, |
| 742 const fileapi::FileSystemURL& path, | 742 const fileapi::FileSystemURL& path, |
| 743 const base::FilePath& temp_file, | 743 const base::FilePath& temp_file, |
| 744 bool* result, | 744 bool* result, |
| 745 base::WaitableEvent* done_event) { | 745 base::WaitableEvent* done_event) { |
| 746 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 746 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 747 context->operation_runner()->CopyInForeignFile( | 747 context->operation_runner()->CopyInForeignFile( |
| 748 temp_file, path, | 748 temp_file, path, |
| 749 base::Bind(&CopyInCompletion, | 749 base::Bind(&CopyInCompletion, |
| 750 base::Unretained(result), | 750 base::Unretained(result), |
| 751 base::Unretained(done_event))); | 751 base::Unretained(done_event))); |
| 752 } | 752 } |
| 753 }; | 753 }; |
| 754 | 754 |
| 755 // TODO(benjhayden) Merge this with the other TestObservers. | 755 // TODO(benjhayden) Merge this with the other TestObservers. |
| 756 class JustInProgressDownloadObserver | 756 class JustInProgressDownloadObserver |
| (...skipping 2892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3649 EXPECT_EQ("suggester", winner_id); | 3649 EXPECT_EQ("suggester", winner_id); |
| 3650 EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value()); | 3650 EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value()); |
| 3651 EXPECT_EQ(api::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); | 3651 EXPECT_EQ(api::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); |
| 3652 EXPECT_FALSE(warnings.empty()); | 3652 EXPECT_FALSE(warnings.empty()); |
| 3653 EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict, | 3653 EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict, |
| 3654 warnings.begin()->warning_type()); | 3654 warnings.begin()->warning_type()); |
| 3655 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); | 3655 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); |
| 3656 } | 3656 } |
| 3657 | 3657 |
| 3658 #endif // http://crbug.com/3061144 | 3658 #endif // http://crbug.com/3061144 |
| OLD | NEW |