Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/files/file_path.h" | |
| 6 #include "base/path_service.h" | |
| 7 #include "chrome/browser/apps/app_browsertest_util.h" | |
| 8 #include "chrome/browser/extensions/component_loader.h" | |
| 9 #include "chrome/browser/extensions/extension_service.h" | |
| 10 #include "chrome/browser/extensions/extension_test_message_listener.h" | |
| 11 #include "extensions/browser/extension_registry.h" | |
| 12 #include "grit/browser_resources.h" | |
| 13 | |
| 14 using extensions::Extension; | |
| 15 using extensions::ExtensionRegistry; | |
| 16 | |
| 17 namespace { | |
| 18 const char* kWallpaperManagerExtensionID = "obklkkbkpaoaejdabbfldmcfplpdgolj"; | |
| 19 } // namespace | |
| 20 | |
| 21 class WallpaperManagerBrowserTest : public extensions::PlatformAppBrowserTest { | |
| 22 public: | |
| 23 WallpaperManagerBrowserTest(); | |
| 24 virtual ~WallpaperManagerBrowserTest(); | |
| 25 | |
| 26 protected: | |
| 27 void LoadAndLaunchWallpaperManager(); | |
| 28 }; | |
| 29 | |
| 30 WallpaperManagerBrowserTest::WallpaperManagerBrowserTest() { | |
| 31 } | |
| 32 | |
| 33 WallpaperManagerBrowserTest::~WallpaperManagerBrowserTest() { | |
| 34 } | |
| 35 | |
| 36 void WallpaperManagerBrowserTest::LoadAndLaunchWallpaperManager() { | |
| 37 extension_service()->component_loader()->Add( | |
| 38 IDR_WALLPAPERMANAGER_MANIFEST, | |
| 39 base::FilePath(FILE_PATH_LITERAL("chromeos/wallpaper_manager"))); | |
| 40 const Extension* wallpaper_app = | |
| 41 ExtensionRegistry::Get(profile())->GetExtensionById( | |
| 42 kWallpaperManagerExtensionID, ExtensionRegistry::EVERYTHING); | |
| 43 LaunchPlatformApp(wallpaper_app); | |
| 44 } | |
| 45 | |
| 46 // Test for crbug.com/410550. | |
| 47 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, DevLaunchApp) { | |
| 48 ExtensionTestMessageListener window_created_listener( | |
| 49 "wallpaper-window-created", false); | |
| 50 ExtensionTestMessageListener launched_listener("launched", false); | |
| 51 LoadAndLaunchWallpaperManager(); | |
| 52 EXPECT_TRUE(window_created_listener.WaitUntilSatisfied()) | |
| 53 << "Wallpaper picker window was not created."; | |
| 54 EXPECT_TRUE(launched_listener.WaitUntilSatisfied()) | |
| 55 << "Wallpaper picker was not loaded."; | |
| 56 } | |
| 57 | |
| 58 // Test for crbug.com/410550. Wallpaper picker should be able to create | |
| 59 // alpha enabled window successfully. | |
| 60 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, StableLaunchApp) { | |
| 61 extensions::ScopedCurrentChannel channel(chrome::VersionInfo::CHANNEL_STABLE); | |
|
kevers
2014/09/23 13:23:40
Optional: Create a private method with the common
bshe
2014/09/23 20:58:21
Done.
| |
| 62 ExtensionTestMessageListener window_created_listener( | |
| 63 "wallpaper-window-created", false); | |
| 64 ExtensionTestMessageListener launched_listener("launched", false); | |
| 65 LoadAndLaunchWallpaperManager(); | |
| 66 EXPECT_TRUE(window_created_listener.WaitUntilSatisfied()) | |
| 67 << "Wallpaper picker window was not created."; | |
| 68 EXPECT_TRUE(launched_listener.WaitUntilSatisfied()) | |
| 69 << "Wallpaper picker was not loaded."; | |
| 70 } | |
| OLD | NEW |