OLD | NEW |
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 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 template<GuestMode M> | 1260 template<GuestMode M> |
1261 class GalleryBrowserTestBase : public FileManagerBrowserTestBase { | 1261 class GalleryBrowserTestBase : public FileManagerBrowserTestBase { |
1262 public: | 1262 public: |
1263 virtual GuestMode GetGuestModeParam() const OVERRIDE { return M; } | 1263 virtual GuestMode GetGuestModeParam() const OVERRIDE { return M; } |
1264 virtual const char* GetTestCaseNameParam() const OVERRIDE { | 1264 virtual const char* GetTestCaseNameParam() const OVERRIDE { |
1265 return test_case_name_.c_str(); | 1265 return test_case_name_.c_str(); |
1266 } | 1266 } |
1267 | 1267 |
1268 protected: | 1268 protected: |
1269 virtual void SetUp() OVERRIDE { | 1269 virtual void SetUp() OVERRIDE { |
| 1270 AddScript("common/test_util_common.js"); |
1270 AddScript("gallery/test_util.js"); | 1271 AddScript("gallery/test_util.js"); |
1271 FileManagerBrowserTestBase::SetUp(); | 1272 FileManagerBrowserTestBase::SetUp(); |
1272 } | 1273 } |
1273 | 1274 |
1274 virtual std::string OnMessage(const std::string& name, | 1275 virtual std::string OnMessage(const std::string& name, |
1275 const base::Value* value) OVERRIDE; | 1276 const base::Value* value) OVERRIDE; |
1276 | 1277 |
1277 virtual const char* GetTestManifestName() const OVERRIDE { | 1278 virtual const char* GetTestManifestName() const OVERRIDE { |
1278 return "gallery_test_manifest.json"; | 1279 return "gallery_test_manifest.json"; |
1279 } | 1280 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 set_test_case_name("exposureImageOnDownloads"); | 1452 set_test_case_name("exposureImageOnDownloads"); |
1452 StartTest(); | 1453 StartTest(); |
1453 } | 1454 } |
1454 | 1455 |
1455 IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, ExposureImageOnDrive) { | 1456 IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, ExposureImageOnDrive) { |
1456 AddScript("gallery/photo_editor.js"); | 1457 AddScript("gallery/photo_editor.js"); |
1457 set_test_case_name("exposureImageOnDrive"); | 1458 set_test_case_name("exposureImageOnDrive"); |
1458 StartTest(); | 1459 StartTest(); |
1459 } | 1460 } |
1460 | 1461 |
| 1462 template<GuestMode M> |
| 1463 class VideoPlayerBrowserTestBase : public FileManagerBrowserTestBase { |
| 1464 public: |
| 1465 virtual GuestMode GetGuestModeParam() const OVERRIDE { return M; } |
| 1466 virtual const char* GetTestCaseNameParam() const OVERRIDE { |
| 1467 return test_case_name_.c_str(); |
| 1468 } |
| 1469 |
| 1470 protected: |
| 1471 virtual void SetUp() OVERRIDE { |
| 1472 AddScript("common/test_util_common.js"); |
| 1473 AddScript("video_player/test_util.js"); |
| 1474 FileManagerBrowserTestBase::SetUp(); |
| 1475 } |
| 1476 |
| 1477 virtual std::string OnMessage(const std::string& name, |
| 1478 const base::Value* value) OVERRIDE; |
| 1479 |
| 1480 virtual const char* GetTestManifestName() const OVERRIDE { |
| 1481 return "video_player_test_manifest.json"; |
| 1482 } |
| 1483 |
| 1484 void AddScript(const std::string& name) { |
| 1485 scripts_.AppendString( |
| 1486 "chrome-extension://ljoplibgfehghmibaoaepfagnmbbfiga/" + name); |
| 1487 } |
| 1488 |
| 1489 void set_test_case_name(const std::string& name) { |
| 1490 test_case_name_ = name; |
| 1491 } |
| 1492 |
| 1493 private: |
| 1494 base::ListValue scripts_; |
| 1495 std::string test_case_name_; |
| 1496 }; |
| 1497 |
| 1498 template<GuestMode M> |
| 1499 std::string VideoPlayerBrowserTestBase<M>::OnMessage(const std::string& name, |
| 1500 const base::Value* value) { |
| 1501 if (name == "getScripts") { |
| 1502 std::string jsonString; |
| 1503 base::JSONWriter::Write(&scripts_, &jsonString); |
| 1504 return jsonString; |
| 1505 } |
| 1506 return FileManagerBrowserTestBase::OnMessage(name, value); |
| 1507 } |
| 1508 |
| 1509 typedef VideoPlayerBrowserTestBase<NOT_IN_GUEST_MODE> VideoPlayerBrowserTest; |
| 1510 typedef VideoPlayerBrowserTestBase<IN_GUEST_MODE> |
| 1511 VideoPlayerBrowserTestInGuestMode; |
| 1512 |
| 1513 IN_PROC_BROWSER_TEST_F(VideoPlayerBrowserTest, OpenSingleVideoOnDownloads) { |
| 1514 AddScript("video_player/open_video_files.js"); |
| 1515 set_test_case_name("openSingleVideoOnDownloads"); |
| 1516 StartTest(); |
| 1517 } |
| 1518 |
| 1519 IN_PROC_BROWSER_TEST_F(VideoPlayerBrowserTest, OpenSingleVideoOnDrive) { |
| 1520 AddScript("video_player/open_video_files.js"); |
| 1521 set_test_case_name("openSingleVideoOnDrive"); |
| 1522 StartTest(); |
| 1523 } |
| 1524 |
1461 } // namespace | 1525 } // namespace |
1462 } // namespace file_manager | 1526 } // namespace file_manager |
OLD | NEW |