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/remove_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/remove_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 "chrome/browser/chromeos/drive/file_system_util.h" | 9 #include "chrome/browser/chromeos/drive/file_system_util.h" |
9 #include "google_apis/drive/test_util.h" | 10 #include "google_apis/drive/test_util.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 | 12 |
12 namespace drive { | 13 namespace drive { |
13 namespace file_system { | 14 namespace file_system { |
14 | 15 |
15 typedef OperationTestBase RemoveOperationTest; | 16 typedef OperationTestBase RemoveOperationTest; |
16 | 17 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 error = FILE_ERROR_FAILED; | 62 error = FILE_ERROR_FAILED; |
62 ASSERT_EQ(FILE_ERROR_NOT_FOUND, | 63 ASSERT_EQ(FILE_ERROR_NOT_FOUND, |
63 GetLocalResourceEntry(nonexisting_file, &entry)); | 64 GetLocalResourceEntry(nonexisting_file, &entry)); |
64 operation.Remove(nonexisting_file, | 65 operation.Remove(nonexisting_file, |
65 false, // is_recursive | 66 false, // is_recursive |
66 google_apis::test_util::CreateCopyResultCallback(&error)); | 67 google_apis::test_util::CreateCopyResultCallback(&error)); |
67 test_util::RunBlockingPoolTask(); | 68 test_util::RunBlockingPoolTask(); |
68 EXPECT_EQ(FILE_ERROR_NOT_FOUND, error); | 69 EXPECT_EQ(FILE_ERROR_NOT_FOUND, error); |
69 | 70 |
70 // Verify observer notifications. | 71 // Verify observer notifications. |
71 EXPECT_EQ(2U, observer()->get_changed_paths().size()); | 72 EXPECT_EQ(2U, observer()->get_changed_files().size()); |
72 EXPECT_TRUE(observer()->get_changed_paths().count(file_in_root.DirName())); | 73 EXPECT_TRUE(observer()->get_changed_files().count(file_in_root)); |
73 EXPECT_TRUE(observer()->get_changed_paths().count(file_in_subdir.DirName())); | 74 EXPECT_TRUE(observer()->get_changed_files().count(file_in_subdir)); |
74 | 75 |
75 EXPECT_EQ(2U, observer()->updated_local_ids().size()); | 76 EXPECT_EQ(2U, observer()->updated_local_ids().size()); |
76 EXPECT_TRUE(observer()->updated_local_ids().count(id_file_in_root)); | 77 EXPECT_TRUE(observer()->updated_local_ids().count(id_file_in_root)); |
77 EXPECT_TRUE(observer()->updated_local_ids().count(id_file_in_subdir)); | 78 EXPECT_TRUE(observer()->updated_local_ids().count(id_file_in_subdir)); |
78 } | 79 } |
79 | 80 |
80 TEST_F(RemoveOperationTest, RemoveDirectory) { | 81 TEST_F(RemoveOperationTest, RemoveDirectory) { |
81 RemoveOperation operation(blocking_task_runner(), observer(), metadata(), | 82 RemoveOperation operation(blocking_task_runner(), observer(), metadata(), |
82 cache()); | 83 cache()); |
83 | 84 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 test_util::RunBlockingPoolTask(); | 122 test_util::RunBlockingPoolTask(); |
122 EXPECT_EQ(FILE_ERROR_OK, error); | 123 EXPECT_EQ(FILE_ERROR_OK, error); |
123 EXPECT_EQ(FILE_ERROR_NOT_FOUND, | 124 EXPECT_EQ(FILE_ERROR_NOT_FOUND, |
124 GetLocalResourceEntry(non_empty_dir, &entry)); | 125 GetLocalResourceEntry(non_empty_dir, &entry)); |
125 EXPECT_EQ(FILE_ERROR_NOT_FOUND, | 126 EXPECT_EQ(FILE_ERROR_NOT_FOUND, |
126 GetLocalResourceEntry(file_in_non_empty_dir, &entry)); | 127 GetLocalResourceEntry(file_in_non_empty_dir, &entry)); |
127 } | 128 } |
128 | 129 |
129 } // namespace file_system | 130 } // namespace file_system |
130 } // namespace drive | 131 } // namespace drive |
OLD | NEW |