| 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/create_file_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/drive/file_change.h" |
| 7 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" | 8 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" |
| 8 #include "google_apis/drive/test_util.h" | 9 #include "google_apis/drive/test_util.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 11 |
| 11 namespace drive { | 12 namespace drive { |
| 12 namespace file_system { | 13 namespace file_system { |
| 13 | 14 |
| 14 typedef OperationTestBase CreateFileOperationTest; | 15 typedef OperationTestBase CreateFileOperationTest; |
| 15 | 16 |
| 16 TEST_F(CreateFileOperationTest, CreateFile) { | 17 TEST_F(CreateFileOperationTest, CreateFile) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 29 EXPECT_EQ(FILE_ERROR_OK, error); | 30 EXPECT_EQ(FILE_ERROR_OK, error); |
| 30 | 31 |
| 31 ResourceEntry entry; | 32 ResourceEntry entry; |
| 32 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kFilePath, &entry)); | 33 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kFilePath, &entry)); |
| 33 EXPECT_EQ(ResourceEntry::DIRTY, entry.metadata_edit_state()); | 34 EXPECT_EQ(ResourceEntry::DIRTY, entry.metadata_edit_state()); |
| 34 EXPECT_FALSE(base::Time::FromInternalValue( | 35 EXPECT_FALSE(base::Time::FromInternalValue( |
| 35 entry.file_info().last_modified()).is_null()); | 36 entry.file_info().last_modified()).is_null()); |
| 36 EXPECT_FALSE(base::Time::FromInternalValue( | 37 EXPECT_FALSE(base::Time::FromInternalValue( |
| 37 entry.file_info().last_accessed()).is_null()); | 38 entry.file_info().last_accessed()).is_null()); |
| 38 | 39 |
| 39 EXPECT_EQ(1u, observer()->get_changed_paths().size()); | 40 EXPECT_EQ(1u, observer()->get_changed_files().size()); |
| 40 EXPECT_EQ(1u, observer()->get_changed_paths().count(kFilePath.DirName())); | 41 EXPECT_EQ(1u, observer()->get_changed_files().count(kFilePath)); |
| 41 EXPECT_EQ(1u, observer()->updated_local_ids().size()); | 42 EXPECT_EQ(1u, observer()->updated_local_ids().size()); |
| 42 EXPECT_EQ(1u, observer()->updated_local_ids().count(entry.local_id())); | 43 EXPECT_EQ(1u, observer()->updated_local_ids().count(entry.local_id())); |
| 43 } | 44 } |
| 44 | 45 |
| 45 TEST_F(CreateFileOperationTest, CreateFileIsExclusive) { | 46 TEST_F(CreateFileOperationTest, CreateFileIsExclusive) { |
| 46 CreateFileOperation operation(blocking_task_runner(), | 47 CreateFileOperation operation(blocking_task_runner(), |
| 47 observer(), | 48 observer(), |
| 48 metadata()); | 49 metadata()); |
| 49 | 50 |
| 50 const base::FilePath kExistingFile( | 51 const base::FilePath kExistingFile( |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 EXPECT_EQ(FILE_ERROR_OK, error); | 151 EXPECT_EQ(FILE_ERROR_OK, error); |
| 151 | 152 |
| 152 // If the mime type is not set and unknown, default to octet-stream. | 153 // If the mime type is not set and unknown, default to octet-stream. |
| 153 ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kUnknown, &entry)); | 154 ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kUnknown, &entry)); |
| 154 EXPECT_EQ("application/octet-stream", | 155 EXPECT_EQ("application/octet-stream", |
| 155 entry.file_specific_info().content_mime_type()); | 156 entry.file_specific_info().content_mime_type()); |
| 156 } | 157 } |
| 157 | 158 |
| 158 } // namespace file_system | 159 } // namespace file_system |
| 159 } // namespace drive | 160 } // namespace drive |
| OLD | NEW |