| 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 700 |
| 701 // Writes an HTML5 file so that it can be downloaded. | 701 // Writes an HTML5 file so that it can be downloaded. |
| 702 class HTML5FileWriter { | 702 class HTML5FileWriter { |
| 703 public: | 703 public: |
| 704 static bool CreateFileForTesting(fileapi::FileSystemContext* context, | 704 static bool CreateFileForTesting(fileapi::FileSystemContext* context, |
| 705 const fileapi::FileSystemURL& path, | 705 const fileapi::FileSystemURL& path, |
| 706 const char*data, | 706 const char*data, |
| 707 int length) { | 707 int length) { |
| 708 // Create a temp file. | 708 // Create a temp file. |
| 709 base::FilePath temp_file; | 709 base::FilePath temp_file; |
| 710 if (!file_util::CreateTemporaryFile(&temp_file) || | 710 if (!base::CreateTemporaryFile(&temp_file) || |
| 711 file_util::WriteFile(temp_file, data, length) != length) { | 711 file_util::WriteFile(temp_file, data, length) != length) { |
| 712 return false; | 712 return false; |
| 713 } | 713 } |
| 714 // Invoke the fileapi to copy it into the sandboxed filesystem. | 714 // Invoke the fileapi to copy it into the sandboxed filesystem. |
| 715 bool result = false; | 715 bool result = false; |
| 716 base::WaitableEvent done_event(true, false); | 716 base::WaitableEvent done_event(true, false); |
| 717 BrowserThread::PostTask( | 717 BrowserThread::PostTask( |
| 718 BrowserThread::IO, FROM_HERE, | 718 BrowserThread::IO, FROM_HERE, |
| 719 base::Bind(&CreateFileForTestingOnIOThread, | 719 base::Bind(&CreateFileForTestingOnIOThread, |
| 720 base::Unretained(context), | 720 base::Unretained(context), |
| (...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3624 EXPECT_EQ("suggester", winner_id); | 3624 EXPECT_EQ("suggester", winner_id); |
| 3625 EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value()); | 3625 EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value()); |
| 3626 EXPECT_EQ(api::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); | 3626 EXPECT_EQ(api::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); |
| 3627 EXPECT_FALSE(warnings.empty()); | 3627 EXPECT_FALSE(warnings.empty()); |
| 3628 EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict, | 3628 EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict, |
| 3629 warnings.begin()->warning_type()); | 3629 warnings.begin()->warning_type()); |
| 3630 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); | 3630 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); |
| 3631 } | 3631 } |
| 3632 | 3632 |
| 3633 #endif // http://crbug.com/3061144 | 3633 #endif // http://crbug.com/3061144 |
| OLD | NEW |