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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_manager_browsertest.cc

Issue 23516014: Files.app: Remove test entries from C++ codes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the comment. Created 7 years, 3 months 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // Browser test for basic Chrome OS file manager functionality: 5 // Browser test for basic Chrome OS file manager functionality:
6 // - The file list is updated when a file is added externally to the Downloads 6 // - The file list is updated when a file is added externally to the Downloads
7 // folder. 7 // folder.
8 // - Selecting a file and copy-pasting it with the keyboard copies the file. 8 // - Selecting a file and copy-pasting it with the keyboard copies the file.
9 // - Selecting a file and pressing delete deletes it. 9 // - Selecting a file and pressing delete deletes it.
10 10
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 void AddEntriesMessage::RegisterJSONConverter( 175 void AddEntriesMessage::RegisterJSONConverter(
176 base::JSONValueConverter<AddEntriesMessage>* converter) { 176 base::JSONValueConverter<AddEntriesMessage>* converter) {
177 converter->RegisterCustomField("volume", 177 converter->RegisterCustomField("volume",
178 &AddEntriesMessage::volume, 178 &AddEntriesMessage::volume,
179 &MapStringToTargetVolume); 179 &MapStringToTargetVolume);
180 converter->RegisterRepeatedMessage<TestEntryInfo>( 180 converter->RegisterRepeatedMessage<TestEntryInfo>(
181 "entries", 181 "entries",
182 &AddEntriesMessage::entries); 182 &AddEntriesMessage::entries);
183 } 183 }
184 184
185 // Create the test entry data for common use.
186 std::vector<TestEntryInfo> createTestEntrySetCommon() {
187 std::vector<TestEntryInfo> entryInfoSet;
188 base::Time time;
189 base::Time::FromString("4 Sep 1998 12:34:56", &time);
190 entryInfoSet.push_back(TestEntryInfo(
191 FILE, "text.txt", "hello.txt", "text/plain", NONE, time));
192 base::Time::FromString("18 Jan 2038 01:02:03", &time);
193 entryInfoSet.push_back(TestEntryInfo(
194 FILE, "image.png", "My Desktop Background.png", "text/plain", NONE,
195 time));
196 base::Time::FromString("12 Nov 2086 12:00:00", &time);
197 entryInfoSet.push_back(TestEntryInfo(
198 FILE, "music.ogg", "Beautiful Song.ogg", "text/plain", NONE, time));
199 base::Time::FromString("4 July 2012 10:35:00", &time);
200 entryInfoSet.push_back(TestEntryInfo(
201 FILE, "video.ogv", "world.ogv", "text/plain", NONE, time));
202 base::Time::FromString("1 Jan 1980 23:59:59", &time);
203 entryInfoSet.push_back(TestEntryInfo(
204 DIRECTORY, "", "photos", "", NONE, time));
205 base::Time::FromString("26 Oct 1985 13:39", &time);
206 entryInfoSet.push_back(TestEntryInfo(
207 DIRECTORY, "", ".warez", "", NONE, time));
208 return entryInfoSet;
209 }
210
211 // Creates the test entry data for the drive volume.
212 std::vector<TestEntryInfo> createTestEntrySetDriveOnly() {
213 std::vector<TestEntryInfo> entryInfoSet;
214 base::Time time;
215 base::Time::FromString("10 Apr 2013 16:20:00", &time);
216 entryInfoSet.push_back(TestEntryInfo(
217 FILE, "", "Test Document", "application/vnd.google-apps.document", NONE,
218 time));
219 base::Time::FromString("20 Mar 2013 22:40:00", &time);
220 entryInfoSet.push_back(TestEntryInfo(
221 FILE, "", "Test Shared Document", "application/vnd.google-apps.document",
222 SHARED, time));
223 return entryInfoSet;
224 }
225
226 // The local volume class for test. 185 // The local volume class for test.
227 // This class provides the operations for a test volume that simulates local 186 // This class provides the operations for a test volume that simulates local
228 // drive. 187 // drive.
229 class LocalTestVolume { 188 class LocalTestVolume {
230 public: 189 public:
231 // Adds this volume to the file system as a local volume. Returns true on 190 // Adds this volume to the file system as a local volume. Returns true on
232 // success. 191 // success.
233 bool Mount(Profile* profile) { 192 bool Mount(Profile* profile) {
234 const std::string kDownloads = "Downloads"; 193 const std::string kDownloads = "Downloads";
235 194
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); 458 ExtensionApiTest::SetUpInProcessBrowserTestFixture();
500 extensions::ComponentLoader::EnableBackgroundExtensionsForTesting(); 459 extensions::ComponentLoader::EnableBackgroundExtensionsForTesting();
501 if (drive_volume_) 460 if (drive_volume_)
502 ASSERT_TRUE(drive_volume_->SetUp()); 461 ASSERT_TRUE(drive_volume_->SetUp());
503 } 462 }
504 463
505 void FileManagerBrowserTest::SetUpOnMainThread() { 464 void FileManagerBrowserTest::SetUpOnMainThread() {
506 ExtensionApiTest::SetUpOnMainThread(); 465 ExtensionApiTest::SetUpOnMainThread();
507 ASSERT_TRUE(local_volume_->Mount(browser()->profile())); 466 ASSERT_TRUE(local_volume_->Mount(browser()->profile()));
508 467
509 const std::vector<TestEntryInfo> testEntrySetCommon(
510 createTestEntrySetCommon());
511 const std::vector<TestEntryInfo> testEntrySetDriveOnly(
512 createTestEntrySetDriveOnly());
513
514 for (size_t i = 0; i < testEntrySetCommon.size(); ++i)
515 local_volume_->CreateEntry(testEntrySetCommon[i]);
516
517 if (drive_volume_) { 468 if (drive_volume_) {
518 // Install the web server to serve the mocked share dialog. 469 // Install the web server to serve the mocked share dialog.
519 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 470 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
520 const GURL share_url_base(embedded_test_server()->GetURL( 471 const GURL share_url_base(embedded_test_server()->GetURL(
521 "/chromeos/file_manager/share_dialog_mock/index.html")); 472 "/chromeos/file_manager/share_dialog_mock/index.html"));
522 drive_volume_->ConfigureShareUrlBase(share_url_base); 473 drive_volume_->ConfigureShareUrlBase(share_url_base);
523
524 for (size_t i = 0; i < testEntrySetCommon.size(); ++i)
525 drive_volume_->CreateEntry(testEntrySetCommon[i]);
526
527 // For testing Drive, create more entries with Drive specific attributes.
528 // TODO(haruki): Add a case for an entry cached by DriveCache.
529 for (size_t i = 0; i < testEntrySetDriveOnly.size(); ++i)
530 drive_volume_->CreateEntry(testEntrySetDriveOnly[i]);
531
532 test_util::WaitUntilDriveMountPointIsAdded(browser()->profile()); 474 test_util::WaitUntilDriveMountPointIsAdded(browser()->profile());
533 } 475 }
534 } 476 }
535 477
536 void FileManagerBrowserTest::SetUpCommandLine(CommandLine* command_line) { 478 void FileManagerBrowserTest::SetUpCommandLine(CommandLine* command_line) {
537 if (std::tr1::get<0>(GetParam()) == IN_GUEST_MODE) { 479 if (std::tr1::get<0>(GetParam()) == IN_GUEST_MODE) {
538 command_line->AppendSwitch(chromeos::switches::kGuestSession); 480 command_line->AppendSwitch(chromeos::switches::kGuestSession);
539 command_line->AppendSwitchNative(chromeos::switches::kLoginUser, ""); 481 command_line->AppendSwitchNative(chromeos::switches::kLoginUser, "");
540 command_line->AppendSwitch(switches::kIncognito); 482 command_line->AppendSwitch(switches::kIncognito);
541 } 483 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 TestParameter(NOT_IN_GUEST_MODE, "shareDirectory"))); 633 TestParameter(NOT_IN_GUEST_MODE, "shareDirectory")));
692 634
693 INSTANTIATE_TEST_CASE_P( 635 INSTANTIATE_TEST_CASE_P(
694 restoreGeometry, 636 restoreGeometry,
695 FileManagerBrowserTest, 637 FileManagerBrowserTest,
696 ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "restoreGeometry"), 638 ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "restoreGeometry"),
697 TestParameter(IN_GUEST_MODE, "restoreGeometry"))); 639 TestParameter(IN_GUEST_MODE, "restoreGeometry")));
698 640
699 } // namespace 641 } // namespace
700 } // namespace file_manager 642 } // namespace file_manager
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698