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 // MediaGalleriesPrivate gallery watch API browser tests. | 5 // MediaGalleriesPrivate 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 class MediaGalleriesPrivateGalleryWatchApiTest : public ExtensionApiTest { | 72 class MediaGalleriesPrivateGalleryWatchApiTest : public ExtensionApiTest { |
73 public: | 73 public: |
74 MediaGalleriesPrivateGalleryWatchApiTest() | 74 MediaGalleriesPrivateGalleryWatchApiTest() |
75 : extension_(NULL), | 75 : extension_(NULL), |
76 background_host_(NULL) { | 76 background_host_(NULL) { |
77 } | 77 } |
78 virtual ~MediaGalleriesPrivateGalleryWatchApiTest() {} | 78 virtual ~MediaGalleriesPrivateGalleryWatchApiTest() {} |
79 | 79 |
80 protected: | 80 protected: |
81 // ExtensionApiTest overrides. | 81 // ExtensionApiTest overrides. |
82 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 82 virtual void SetUpCommandLine(CommandLine* command_line) override { |
83 ExtensionApiTest::SetUpCommandLine(command_line); | 83 ExtensionApiTest::SetUpCommandLine(command_line); |
84 command_line->AppendSwitchASCII( | 84 command_line->AppendSwitchASCII( |
85 extensions::switches::kWhitelistedExtensionID, | 85 extensions::switches::kWhitelistedExtensionID, |
86 kTestExtensionId); | 86 kTestExtensionId); |
87 } | 87 } |
88 virtual void SetUpOnMainThread() OVERRIDE { | 88 virtual void SetUpOnMainThread() override { |
89 ExtensionApiTest::SetUpOnMainThread(); | 89 ExtensionApiTest::SetUpOnMainThread(); |
90 ensure_media_directories_exists_.reset(new EnsureMediaDirectoriesExists); | 90 ensure_media_directories_exists_.reset(new EnsureMediaDirectoriesExists); |
91 extension_ = LoadExtension(test_data_dir_.AppendASCII(kTestExtensionPath)); | 91 extension_ = LoadExtension(test_data_dir_.AppendASCII(kTestExtensionPath)); |
92 GetBackgroundHostForTestExtension(); | 92 GetBackgroundHostForTestExtension(); |
93 CreateTestGallery(); | 93 CreateTestGallery(); |
94 FetchMediaGalleriesList(); | 94 FetchMediaGalleriesList(); |
95 } | 95 } |
96 virtual void TearDownOnMainThread() OVERRIDE { | 96 virtual void TearDownOnMainThread() override { |
97 extension_ = NULL; | 97 extension_ = NULL; |
98 background_host_ = NULL; | 98 background_host_ = NULL; |
99 ensure_media_directories_exists_.reset(); | 99 ensure_media_directories_exists_.reset(); |
100 ExtensionApiTest::TearDownOnMainThread(); | 100 ExtensionApiTest::TearDownOnMainThread(); |
101 } | 101 } |
102 | 102 |
103 bool GalleryWatchesSupported() { | 103 bool GalleryWatchesSupported() { |
104 return base::FilePathWatcher::RecursiveWatchAvailable(); | 104 return base::FilePathWatcher::RecursiveWatchAvailable(); |
105 } | 105 } |
106 | 106 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // Remove all gallery watchers. | 337 // Remove all gallery watchers. |
338 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK); | 338 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK); |
339 | 339 |
340 // Gallery watchers removed. chrome.mediaGalleriesPrivate.getAllGalleryWatch | 340 // Gallery watchers removed. chrome.mediaGalleriesPrivate.getAllGalleryWatch |
341 // should return an empty list. | 341 // should return an empty list. |
342 ExtensionTestMessageListener final_get_all_check_finished( | 342 ExtensionTestMessageListener final_get_all_check_finished( |
343 kNoGalleryWatchesInstalled, false /* no reply */); | 343 kNoGalleryWatchesInstalled, false /* no reply */); |
344 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); | 344 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); |
345 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); | 345 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); |
346 } | 346 } |
OLD | NEW |