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/update_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/update_operation.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" | 7 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" |
8 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 8 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
9 #include "chrome/browser/drive/fake_drive_service.h" | 9 #include "chrome/browser/drive/fake_drive_service.h" |
10 #include "chrome/browser/google_apis/gdata_wapi_parser.h" | 10 #include "chrome/browser/google_apis/gdata_wapi_parser.h" |
11 #include "chrome/browser/google_apis/test_util.h" | 11 #include "chrome/browser/google_apis/test_util.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace drive { | 14 namespace drive { |
15 namespace file_system { | 15 namespace file_system { |
16 | 16 |
17 class UpdateOperationTest : public OperationTestBase { | 17 class UpdateOperationTest : public OperationTestBase { |
18 protected: | 18 protected: |
19 virtual void SetUp() OVERRIDE { | 19 virtual void SetUp() OVERRIDE { |
20 OperationTestBase::SetUp(); | 20 OperationTestBase::SetUp(); |
21 operation_.reset(new UpdateOperation(blocking_task_runner(), | 21 operation_.reset(new UpdateOperation(blocking_task_runner(), |
22 observer(), | 22 observer(), |
23 scheduler(), | 23 scheduler(), |
24 metadata(), | 24 metadata(), |
25 cache())); | 25 cache())); |
26 } | 26 } |
27 | 27 |
28 virtual void TearDown() OVERRIDE { | |
29 operation_.reset(); | |
30 OperationTestBase::TearDown(); | |
31 } | |
32 | |
33 scoped_ptr<UpdateOperation> operation_; | 28 scoped_ptr<UpdateOperation> operation_; |
34 }; | 29 }; |
35 | 30 |
36 TEST_F(UpdateOperationTest, UpdateFileByResourceId_PersistentFile) { | 31 TEST_F(UpdateOperationTest, UpdateFileByResourceId_PersistentFile) { |
37 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt")); | 32 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
38 const std::string kResourceId("file:2_file_resource_id"); | 33 const std::string kResourceId("file:2_file_resource_id"); |
39 const std::string kMd5("3b4382ebefec6e743578c76bbd0575ce"); | 34 const std::string kMd5("3b4382ebefec6e743578c76bbd0575ce"); |
40 | 35 |
41 const base::FilePath kTestFile = temp_dir().Append(FILE_PATH_LITERAL("foo")); | 36 const base::FilePath kTestFile = temp_dir().Append(FILE_PATH_LITERAL("foo")); |
42 const std::string kTestFileContent = "I'm being uploaded! Yay!"; | 37 const std::string kTestFileContent = "I'm being uploaded! Yay!"; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 operation_->UpdateFileByResourceId( | 95 operation_->UpdateFileByResourceId( |
101 "file:nonexistent_resource_id", | 96 "file:nonexistent_resource_id", |
102 ClientContext(USER_INITIATED), | 97 ClientContext(USER_INITIATED), |
103 google_apis::test_util::CreateCopyResultCallback(&error)); | 98 google_apis::test_util::CreateCopyResultCallback(&error)); |
104 google_apis::test_util::RunBlockingPoolTask(); | 99 google_apis::test_util::RunBlockingPoolTask(); |
105 EXPECT_EQ(FILE_ERROR_NOT_FOUND, error); | 100 EXPECT_EQ(FILE_ERROR_NOT_FOUND, error); |
106 } | 101 } |
107 | 102 |
108 } // namespace file_system | 103 } // namespace file_system |
109 } // namespace drive | 104 } // namespace drive |
OLD | NEW |