ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chrome / browser / chromeos / extensions / wallpaper_manager_browsertest.cc
blob7007c30fefbcb47fc4da84f71efedf7ebfd075df
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.
5 #include "base/files/file_path.h"
6 #include "chrome/browser/apps/app_browsertest_util.h"
7 #include "chrome/browser/extensions/component_loader.h"
8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "chrome/test/base/ui_test_utils.h"
11 #include "content/public/test/browser_test_utils.h"
12 #include "extensions/browser/extension_registry.h"
13 #include "extensions/test/extension_test_message_listener.h"
14 #include "grit/browser_resources.h"
16 using extensions::Extension;
17 using extensions::ExtensionRegistry;
19 namespace {
20 const char kWallpaperManagerExtensionID[] = "obklkkbkpaoaejdabbfldmcfplpdgolj";
21 } // namespace
23 class WallpaperManagerBrowserTest : public extensions::PlatformAppBrowserTest {
24 public:
25 WallpaperManagerBrowserTest();
26 ~WallpaperManagerBrowserTest() override;
28 protected:
29 void VerifyWallpaperManagerLoaded();
31 private:
32 void LoadAndLaunchWallpaperManager();
35 WallpaperManagerBrowserTest::WallpaperManagerBrowserTest() {
38 WallpaperManagerBrowserTest::~WallpaperManagerBrowserTest() {
41 void WallpaperManagerBrowserTest::LoadAndLaunchWallpaperManager() {
42 extension_service()->component_loader()->Add(
43 IDR_WALLPAPERMANAGER_MANIFEST,
44 base::FilePath(FILE_PATH_LITERAL("chromeos/wallpaper_manager")));
45 const Extension* wallpaper_app =
46 ExtensionRegistry::Get(profile())->GetExtensionById(
47 kWallpaperManagerExtensionID, ExtensionRegistry::EVERYTHING);
48 LaunchPlatformApp(wallpaper_app);
51 void WallpaperManagerBrowserTest::VerifyWallpaperManagerLoaded() {
52 ExtensionTestMessageListener window_created_listener(
53 "wallpaper-window-created", false);
54 ExtensionTestMessageListener launched_listener("launched", false);
55 LoadAndLaunchWallpaperManager();
56 EXPECT_TRUE(window_created_listener.WaitUntilSatisfied())
57 << "Wallpaper picker window was not created.";
58 EXPECT_TRUE(launched_listener.WaitUntilSatisfied())
59 << "Wallpaper picker was not loaded.";
62 // Test for crbug.com/410550.
63 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, DevLaunchApp) {
64 VerifyWallpaperManagerLoaded();
67 // Test for crbug.com/410550. Wallpaper picker should be able to create
68 // alpha enabled window successfully.
69 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, StableLaunchApp) {
70 extensions::ScopedCurrentChannel channel(chrome::VersionInfo::CHANNEL_STABLE);
71 VerifyWallpaperManagerLoaded();
74 class WallpaperManagerJsTest : public InProcessBrowserTest {
75 public:
76 void RunTest(const base::FilePath& file) {
77 GURL url = ui_test_utils::GetTestUrl(
78 base::FilePath(
79 FILE_PATH_LITERAL("chromeos/wallpaper_manager/unit_tests")),
80 file);
81 ui_test_utils::NavigateToURL(browser(), url);
83 content::WebContents* web_contents =
84 browser()->tab_strip_model()->GetActiveWebContents();
85 ASSERT_TRUE(web_contents);
87 const std::vector<int> empty_libraries;
88 EXPECT_TRUE(ExecuteWebUIResourceTest(web_contents, empty_libraries));
92 IN_PROC_BROWSER_TEST_F(WallpaperManagerJsTest, EventPageTest) {
93 RunTest(base::FilePath(FILE_PATH_LITERAL("event_page_unittest.html")));