| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/file_system/get_file_for_saving_operatio
n.h" | 5 #include "chrome/browser/chromeos/drive/file_system/get_file_for_saving_operatio
n.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 void set_quit_closure(const base::Closure& quit_closure) { | 30 void set_quit_closure(const base::Closure& quit_closure) { |
| 31 quit_closure_ = quit_closure; | 31 quit_closure_ = quit_closure; |
| 32 } | 32 } |
| 33 | 33 |
| 34 const std::string& updated_local_id() const { | 34 const std::string& updated_local_id() const { |
| 35 return updated_local_id_; | 35 return updated_local_id_; |
| 36 } | 36 } |
| 37 | 37 |
| 38 // OperationDelegate overrides. | 38 // OperationDelegate overrides. |
| 39 virtual void OnEntryUpdatedByOperation(const std::string& local_id) OVERRIDE { | 39 virtual void OnEntryUpdatedByOperation(const std::string& local_id) override { |
| 40 updated_local_id_ = local_id; | 40 updated_local_id_ = local_id; |
| 41 if (!quit_closure_.is_null()) | 41 if (!quit_closure_.is_null()) |
| 42 quit_closure_.Run(); | 42 quit_closure_.Run(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 std::string updated_local_id_; | 46 std::string updated_local_id_; |
| 47 base::Closure quit_closure_; | 47 base::Closure quit_closure_; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 class GetFileForSavingOperationTest : public OperationTestBase { | 52 class GetFileForSavingOperationTest : public OperationTestBase { |
| 53 protected: | 53 protected: |
| 54 // FileWriteWatcher requires TYPE_IO message loop to run. | 54 // FileWriteWatcher requires TYPE_IO message loop to run. |
| 55 GetFileForSavingOperationTest() | 55 GetFileForSavingOperationTest() |
| 56 : OperationTestBase(content::TestBrowserThreadBundle::IO_MAINLOOP) { | 56 : OperationTestBase(content::TestBrowserThreadBundle::IO_MAINLOOP) { |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual void SetUp() OVERRIDE { | 59 virtual void SetUp() override { |
| 60 OperationTestBase::SetUp(); | 60 OperationTestBase::SetUp(); |
| 61 | 61 |
| 62 operation_.reset(new GetFileForSavingOperation( | 62 operation_.reset(new GetFileForSavingOperation( |
| 63 logger(), blocking_task_runner(), &delegate_, scheduler(), metadata(), | 63 logger(), blocking_task_runner(), &delegate_, scheduler(), metadata(), |
| 64 cache(), temp_dir())); | 64 cache(), temp_dir())); |
| 65 operation_->file_write_watcher_for_testing()->DisableDelayForTesting(); | 65 operation_->file_write_watcher_for_testing()->DisableDelayForTesting(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 TestDelegate delegate_; | 68 TestDelegate delegate_; |
| 69 scoped_ptr<GetFileForSavingOperation> operation_; | 69 scoped_ptr<GetFileForSavingOperation> operation_; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 google_apis::test_util::CreateCopyResultCallback( | 142 google_apis::test_util::CreateCopyResultCallback( |
| 143 &error, &local_path, &entry)); | 143 &error, &local_path, &entry)); |
| 144 content::RunAllBlockingPoolTasksUntilIdle(); | 144 content::RunAllBlockingPoolTasksUntilIdle(); |
| 145 | 145 |
| 146 // Checks that an error is returned. | 146 // Checks that an error is returned. |
| 147 EXPECT_EQ(FILE_ERROR_EXISTS, error); | 147 EXPECT_EQ(FILE_ERROR_EXISTS, error); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace file_system | 150 } // namespace file_system |
| 151 } // namespace drive | 151 } // namespace drive |
| OLD | NEW |