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 #include <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1800 FilePath nonexisting_file(FILE_PATH_LITERAL("drive/Dummy file.txt")); | 1800 FilePath nonexisting_file(FILE_PATH_LITERAL("drive/Dummy file.txt")); |
1801 FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); | 1801 FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); |
1802 FilePath dir_in_root(FILE_PATH_LITERAL("drive/Directory 1")); | 1802 FilePath dir_in_root(FILE_PATH_LITERAL("drive/Directory 1")); |
1803 FilePath file_in_subdir( | 1803 FilePath file_in_subdir( |
1804 FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); | 1804 FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); |
1805 | 1805 |
1806 ASSERT_TRUE(EntryExists(file_in_root)); | 1806 ASSERT_TRUE(EntryExists(file_in_root)); |
1807 scoped_ptr<GDataEntryProto> file_in_root_proto = GetEntryInfoByPathSync( | 1807 scoped_ptr<GDataEntryProto> file_in_root_proto = GetEntryInfoByPathSync( |
1808 file_in_root); | 1808 file_in_root); |
1809 ASSERT_TRUE(file_in_root_proto.get()); | 1809 ASSERT_TRUE(file_in_root_proto.get()); |
1810 std::string file_in_root_resource_id = file_in_root_proto->resource_id(); | |
1811 | 1810 |
1812 ASSERT_TRUE(EntryExists(dir_in_root)); | 1811 ASSERT_TRUE(EntryExists(dir_in_root)); |
1813 scoped_ptr<GDataEntryProto> dir_in_root_proto = GetEntryInfoByPathSync( | 1812 scoped_ptr<GDataEntryProto> dir_in_root_proto = GetEntryInfoByPathSync( |
1814 dir_in_root); | 1813 dir_in_root); |
1815 ASSERT_TRUE(dir_in_root_proto.get()); | 1814 ASSERT_TRUE(dir_in_root_proto.get()); |
1816 ASSERT_TRUE(dir_in_root_proto->file_info().is_directory()); | 1815 ASSERT_TRUE(dir_in_root_proto->file_info().is_directory()); |
1817 | 1816 |
1818 ASSERT_TRUE(EntryExists(file_in_subdir)); | 1817 ASSERT_TRUE(EntryExists(file_in_subdir)); |
1819 scoped_ptr<GDataEntryProto> file_in_subdir_proto = GetEntryInfoByPathSync( | 1818 scoped_ptr<GDataEntryProto> file_in_subdir_proto = GetEntryInfoByPathSync( |
1820 file_in_subdir); | 1819 file_in_subdir); |
1821 ASSERT_TRUE(file_in_subdir_proto.get()); | 1820 ASSERT_TRUE(file_in_subdir_proto.get()); |
1822 std::string file_in_subdir_resource_id = file_in_subdir_proto->resource_id(); | |
1823 | 1821 |
1824 // Once for file in root and once for file... | 1822 // Once for file in root and once for file... |
1825 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( | 1823 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( |
1826 Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); | 1824 Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); |
1827 | 1825 |
1828 // Remove first file in root. | 1826 // Remove first file in root. |
1829 EXPECT_TRUE(RemoveEntry(file_in_root)); | 1827 EXPECT_TRUE(RemoveEntry(file_in_root)); |
1830 EXPECT_FALSE(EntryExists(file_in_root)); | 1828 EXPECT_FALSE(EntryExists(file_in_root)); |
1831 EXPECT_TRUE(EntryExists(dir_in_root)); | 1829 EXPECT_TRUE(EntryExists(dir_in_root)); |
1832 EXPECT_TRUE(EntryExists(file_in_subdir)); | 1830 EXPECT_TRUE(EntryExists(file_in_subdir)); |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2618 | 2616 |
2619 // Try to close the same file twice. | 2617 // Try to close the same file twice. |
2620 file_system_->CloseFile(kFileInRoot, close_file_callback); | 2618 file_system_->CloseFile(kFileInRoot, close_file_callback); |
2621 message_loop_.Run(); | 2619 message_loop_.Run(); |
2622 | 2620 |
2623 // It must fail. | 2621 // It must fail. |
2624 EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); | 2622 EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); |
2625 } | 2623 } |
2626 | 2624 |
2627 } // namespace gdata | 2625 } // namespace gdata |
OLD | NEW |