OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // MediaGalleries gallery watch API browser tests. | 5 // MediaGalleries gallery watch API browser tests. |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_path_watcher.h" | 8 #include "base/files/file_path_watcher.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 /////////////////////////////////////////////////////////////////////////////// | 76 /////////////////////////////////////////////////////////////////////////////// |
77 | 77 |
78 class MediaGalleriesGalleryWatchApiTest : public ExtensionApiTest { | 78 class MediaGalleriesGalleryWatchApiTest : public ExtensionApiTest { |
79 public: | 79 public: |
80 MediaGalleriesGalleryWatchApiTest() | 80 MediaGalleriesGalleryWatchApiTest() |
81 : extension_(NULL), background_host_(NULL) {} | 81 : extension_(NULL), background_host_(NULL) {} |
82 virtual ~MediaGalleriesGalleryWatchApiTest() {} | 82 virtual ~MediaGalleriesGalleryWatchApiTest() {} |
83 | 83 |
84 protected: | 84 protected: |
85 // ExtensionApiTest overrides. | 85 // ExtensionApiTest overrides. |
86 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 86 virtual void SetUpCommandLine(CommandLine* command_line) override { |
87 ExtensionApiTest::SetUpCommandLine(command_line); | 87 ExtensionApiTest::SetUpCommandLine(command_line); |
88 command_line->AppendSwitchASCII( | 88 command_line->AppendSwitchASCII( |
89 extensions::switches::kWhitelistedExtensionID, kTestExtensionId); | 89 extensions::switches::kWhitelistedExtensionID, kTestExtensionId); |
90 } | 90 } |
91 virtual void SetUpOnMainThread() OVERRIDE { | 91 virtual void SetUpOnMainThread() override { |
92 ExtensionApiTest::SetUpOnMainThread(); | 92 ExtensionApiTest::SetUpOnMainThread(); |
93 ensure_media_directories_exists_.reset(new EnsureMediaDirectoriesExists); | 93 ensure_media_directories_exists_.reset(new EnsureMediaDirectoriesExists); |
94 extension_ = LoadExtension(test_data_dir_.AppendASCII(kTestExtensionPath)); | 94 extension_ = LoadExtension(test_data_dir_.AppendASCII(kTestExtensionPath)); |
95 GetBackgroundHostForTestExtension(); | 95 GetBackgroundHostForTestExtension(); |
96 CreateTestGallery(); | 96 CreateTestGallery(); |
97 FetchMediaGalleriesList(); | 97 FetchMediaGalleriesList(); |
98 } | 98 } |
99 virtual void TearDownOnMainThread() OVERRIDE { | 99 virtual void TearDownOnMainThread() override { |
100 extension_ = NULL; | 100 extension_ = NULL; |
101 background_host_ = NULL; | 101 background_host_ = NULL; |
102 ensure_media_directories_exists_.reset(); | 102 ensure_media_directories_exists_.reset(); |
103 ExtensionApiTest::TearDownOnMainThread(); | 103 ExtensionApiTest::TearDownOnMainThread(); |
104 } | 104 } |
105 | 105 |
106 bool GalleryWatchesSupported() { | 106 bool GalleryWatchesSupported() { |
107 return base::FilePathWatcher::RecursiveWatchAvailable(); | 107 return base::FilePathWatcher::RecursiveWatchAvailable(); |
108 } | 108 } |
109 | 109 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // Remove all gallery watchers. | 355 // Remove all gallery watchers. |
356 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK); | 356 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK); |
357 | 357 |
358 // Gallery watchers removed. chrome.mediaGalleries.getAllGalleryWatch | 358 // Gallery watchers removed. chrome.mediaGalleries.getAllGalleryWatch |
359 // should return an empty list. | 359 // should return an empty list. |
360 ExtensionTestMessageListener final_get_all_check_finished( | 360 ExtensionTestMessageListener final_get_all_check_finished( |
361 kNoGalleryWatchesInstalled, false /* no reply */); | 361 kNoGalleryWatchesInstalled, false /* no reply */); |
362 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); | 362 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); |
363 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); | 363 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); |
364 } | 364 } |
OLD | NEW |