| 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" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/extensions/extension_apitest.h" | 15 #include "chrome/browser/extensions/extension_apitest.h" |
| 16 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
| 17 #include "chrome/browser/extensions/extension_test_message_listener.h" | |
| 18 #include "chrome/browser/media_galleries/media_file_system_registry.h" | 17 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
| 19 #include "chrome/browser/media_galleries/media_galleries_preferences.h" | 18 #include "chrome/browser/media_galleries/media_galleries_preferences.h" |
| 20 #include "chrome/browser/media_galleries/media_galleries_test_util.h" | 19 #include "chrome/browser/media_galleries/media_galleries_test_util.h" |
| 21 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 22 #include "content/public/browser/render_frame_host.h" | 21 #include "content/public/browser/render_frame_host.h" |
| 23 #include "content/public/browser/render_view_host.h" | 22 #include "content/public/browser/render_view_host.h" |
| 24 #include "extensions/browser/extension_system.h" | 23 #include "extensions/browser/extension_system.h" |
| 25 #include "extensions/common/extension.h" | 24 #include "extensions/common/extension.h" |
| 26 #include "extensions/common/switches.h" | 25 #include "extensions/common/switches.h" |
| 26 #include "extensions/test/extension_test_message_listener.h" |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 // Id of test extension from | 30 // Id of test extension from |
| 31 // chrome/test/data/extensions/api_test/|kTestExtensionPath| | 31 // chrome/test/data/extensions/api_test/|kTestExtensionPath| |
| 32 const char kTestExtensionId[] = "gceegfkgibmgpfopknlcgleimclbknie"; | 32 const char kTestExtensionId[] = "gceegfkgibmgpfopknlcgleimclbknie"; |
| 33 const char kTestExtensionPath[] = "media_galleries/gallerywatch"; | 33 const char kTestExtensionPath[] = "media_galleries/gallerywatch"; |
| 34 | 34 |
| 35 // JS commands. | 35 // JS commands. |
| 36 const char kGetAllWatchedGalleryIdsCmd[] = "getAllWatchedGalleryIds()"; | 36 const char kGetAllWatchedGalleryIdsCmd[] = "getAllWatchedGalleryIds()"; |
| (...skipping 318 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 |