| 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/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/extensions/extension_apitest.h" | 12 #include "chrome/browser/extensions/extension_apitest.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/extensions/extension_system.h" | 14 #include "chrome/browser/extensions/extension_system.h" |
| 15 #include "chrome/browser/extensions/extension_test_message_listener.h" | 15 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 16 #include "chrome/browser/media_galleries/media_galleries_test_util.h" | 16 #include "chrome/browser/media_galleries/media_galleries_test_util.h" |
| 17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
| 20 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Id of test extension from | 24 // Id of test extension from |
| 25 // chrome/test/data/extensions/api_test/|kTestExtensionPath| | 25 // chrome/test/data/extensions/api_test/|kTestExtensionPath| |
| 26 const char kTestExtensionId[] = "gceegfkgibmgpfopknlcgleimclbknie"; | 26 const char kTestExtensionId[] = "gceegfkgibmgpfopknlcgleimclbknie"; |
| 27 const char kTestExtensionPath[] = "media_galleries_private/gallerywatch"; | 27 const char kTestExtensionPath[] = "media_galleries_private/gallerywatch"; |
| 28 | 28 |
| 29 #if !defined(OS_CHROMEOS) |
| 29 // JS commands. | 30 // JS commands. |
| 30 const char kGetAllWatchedGalleryIdsCmd[] = "getAllWatchedGalleryIds()"; | 31 const char kGetAllWatchedGalleryIdsCmd[] = "getAllWatchedGalleryIds()"; |
| 31 const char kGetMediaFileSystemsCmd[] = "getMediaFileSystems()"; | 32 const char kGetMediaFileSystemsCmd[] = "getMediaFileSystems()"; |
| 32 const char kSetupWatchOnValidGalleriesCmd[] = "setupWatchOnValidGalleries()"; | 33 const char kSetupWatchOnValidGalleriesCmd[] = "setupWatchOnValidGalleries()"; |
| 33 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| 34 const char kAddGalleryChangedListenerCmd[] = "addGalleryChangedListener()"; | 35 const char kAddGalleryChangedListenerCmd[] = "addGalleryChangedListener()"; |
| 35 const char kRemoveAllGalleryWatchCmd[] = "removeAllGalleryWatch()"; | 36 const char kRemoveAllGalleryWatchCmd[] = "removeAllGalleryWatch()"; |
| 36 const char kRemoveGalleryChangedListenerCmd[] = | 37 const char kRemoveGalleryChangedListenerCmd[] = |
| 37 "removeGalleryChangedListener()"; | 38 "removeGalleryChangedListener()"; |
| 38 const char kRemoveGalleryWatchCmd[] = "removeGalleryWatch()"; | 39 const char kRemoveGalleryWatchCmd[] = "removeGalleryWatch()"; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 55 | 56 |
| 56 // Test reply messages. | 57 // Test reply messages. |
| 57 const char kGetAllGalleryWatchResultA[] = "gallery_watchers_does_not_exists"; | 58 const char kGetAllGalleryWatchResultA[] = "gallery_watchers_does_not_exists"; |
| 58 const char kAddGalleryWatchRequestFailed[] = "add_watch_request_failed"; | 59 const char kAddGalleryWatchRequestFailed[] = "add_watch_request_failed"; |
| 59 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
| 60 const char kAddGalleryWatchRequestSucceeded[] = "add_watch_request_succeeded"; | 61 const char kAddGalleryWatchRequestSucceeded[] = "add_watch_request_succeeded"; |
| 61 const char kGalleryChangedEventReceived[] = "gallery_changed_event_received"; | 62 const char kGalleryChangedEventReceived[] = "gallery_changed_event_received"; |
| 62 const char kGetAllGalleryWatchResultB[] = | 63 const char kGetAllGalleryWatchResultB[] = |
| 63 "watchers_for_galleries_{1, 2, 3}_found"; | 64 "watchers_for_galleries_{1, 2, 3}_found"; |
| 64 #endif // defined(OS_WIN) | 65 #endif // defined(OS_WIN) |
| 66 #endif // !defined(OS_CHROMEOS) |
| 65 | 67 |
| 66 } // namespace | 68 } // namespace |
| 67 | 69 |
| 68 | 70 |
| 69 /////////////////////////////////////////////////////////////////////////////// | 71 /////////////////////////////////////////////////////////////////////////////// |
| 70 // MediaGalleriesPrivateGalleryWatchApiTest // | 72 // MediaGalleriesPrivateGalleryWatchApiTest // |
| 71 /////////////////////////////////////////////////////////////////////////////// | 73 /////////////////////////////////////////////////////////////////////////////// |
| 72 | 74 |
| 73 class MediaGalleriesPrivateGalleryWatchApiTest : public ExtensionApiTest { | 75 class MediaGalleriesPrivateGalleryWatchApiTest : public ExtensionApiTest { |
| 74 public: | 76 public: |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 // Gallery watchers does not exists. | 425 // Gallery watchers does not exists. |
| 424 // chrome.mediaGalleriesPrivate.getAllGalleryWatch should return an empty | 426 // chrome.mediaGalleriesPrivate.getAllGalleryWatch should return an empty |
| 425 // list. | 427 // list. |
| 426 ExtensionTestMessageListener get_all_gallery_watch_finished( | 428 ExtensionTestMessageListener get_all_gallery_watch_finished( |
| 427 kGetAllGalleryWatchResultA, false /* no reply */); | 429 kGetAllGalleryWatchResultA, false /* no reply */); |
| 428 ExecuteCmdAndCheckReply(host, kGetAllWatchedGalleryIdsCmd, | 430 ExecuteCmdAndCheckReply(host, kGetAllWatchedGalleryIdsCmd, |
| 429 kGetAllGalleryWatchOK); | 431 kGetAllGalleryWatchOK); |
| 430 EXPECT_TRUE(get_all_gallery_watch_finished.WaitUntilSatisfied()); | 432 EXPECT_TRUE(get_all_gallery_watch_finished.WaitUntilSatisfied()); |
| 431 } | 433 } |
| 432 #endif | 434 #endif |
| OLD | NEW |