Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: chrome/browser/chromeos/drive/change_list_processor_unittest.cc

Issue 119823002: drive: Show files shared to me from other account's shared folder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/change_list_processor.h" 5 #include "chrome/browser/chromeos/drive/change_list_processor.h"
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/drive/drive.pb.h" 10 #include "chrome/browser/chromeos/drive/drive.pb.h"
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 change_lists.Pass(), 575 change_lists.Pass(),
576 &file_path)); 576 &file_path));
577 EXPECT_EQ(util::GetDriveMyDriveRootPath().value(), file_path.value()); 577 EXPECT_EQ(util::GetDriveMyDriveRootPath().value(), file_path.value());
578 578
579 // "new_file" should not be added. 579 // "new_file" should not be added.
580 ResourceEntry entry; 580 ResourceEntry entry;
581 EXPECT_EQ(FILE_ERROR_NOT_FOUND, metadata_->GetResourceEntryByPath( 581 EXPECT_EQ(FILE_ERROR_NOT_FOUND, metadata_->GetResourceEntryByPath(
582 util::GetDriveMyDriveRootPath().AppendASCII(new_file.title()), &entry)); 582 util::GetDriveMyDriveRootPath().AppendASCII(new_file.title()), &entry));
583 } 583 }
584 584
585 TEST_F(ChangeListProcessorTest, SharedFilesWithNoParentInFeed) {
586 // Prepare metadata.
587 EXPECT_EQ(FILE_ERROR_OK,
588 ApplyFullResourceList(ParseChangeList(kBaseResourceListFile)));
589
590 // Create change lists.
591 ScopedVector<ChangeList> change_lists;
592 change_lists.push_back(new ChangeList);
593
594 // Add a new file with non-existing parent resource id to the change lists.
595 ResourceEntry new_file;
596 new_file.set_title("new_file");
597 new_file.set_resource_id("new_file_id");
598 change_lists[0]->mutable_entries()->push_back(new_file);
599 change_lists[0]->mutable_parent_resource_ids()->push_back("nonexisting");
600 change_lists[0]->set_largest_changestamp(kBaseResourceListChangestamp + 1);
601
602 std::set<base::FilePath> changed_dirs;
603 EXPECT_EQ(FILE_ERROR_OK, ApplyChangeList(change_lists.Pass(), &changed_dirs));
604
605 // "new_file" should be added under drive/other.
606 ResourceEntry entry;
607 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryByPath(
608 util::GetDriveGrandRootPath().AppendASCII("other/new_file"), &entry));
609 }
610
585 } // namespace internal 611 } // namespace internal
586 } // namespace drive 612 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698