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 #include "apps/app_window.h" | 5 #include "apps/app_window.h" |
6 #include "apps/app_window_registry.h" | 6 #include "apps/app_window_registry.h" |
7 #include "apps/ui/native_app_window.h" | 7 #include "apps/ui/native_app_window.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chrome/browser/apps/app_browsertest_util.h" | 10 #include "chrome/browser/apps/app_browsertest_util.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 }; | 44 }; |
45 | 45 |
46 } // namespace | 46 } // namespace |
47 | 47 |
48 namespace extensions { | 48 namespace extensions { |
49 | 49 |
50 // Tests chrome.app.window.setIcon. | 50 // Tests chrome.app.window.setIcon. |
51 IN_PROC_BROWSER_TEST_F(ExperimentalPlatformAppBrowserTest, WindowsApiSetIcon) { | 51 IN_PROC_BROWSER_TEST_F(ExperimentalPlatformAppBrowserTest, WindowsApiSetIcon) { |
52 scoped_ptr<TestAppWindowRegistryObserver> test_observer( | 52 scoped_ptr<TestAppWindowRegistryObserver> test_observer( |
53 new TestAppWindowRegistryObserver(browser()->profile())); | 53 new TestAppWindowRegistryObserver(browser()->profile())); |
54 LoadAndLaunchPlatformApp("windows_api_set_icon", "IconSet"); | 54 ExtensionTestMessageListener listener("ready", true); |
| 55 |
| 56 // Launch the app and wait for it to be ready. |
| 57 LoadAndLaunchPlatformApp("windows_api_set_icon", &listener); |
55 EXPECT_EQ(0, test_observer->icon_updates()); | 58 EXPECT_EQ(0, test_observer->icon_updates()); |
| 59 listener.Reply(""); |
| 60 |
56 // Now wait until the WebContent has decoded the icon and chrome has | 61 // Now wait until the WebContent has decoded the icon and chrome has |
57 // processed it. This needs to be in a loop since the renderer runs in a | 62 // processed it. This needs to be in a loop since the renderer runs in a |
58 // different process. | 63 // different process. |
59 while (test_observer->icon_updates() < 1) { | 64 while (test_observer->icon_updates() < 1) { |
60 base::RunLoop run_loop; | 65 base::RunLoop run_loop; |
61 run_loop.RunUntilIdle(); | 66 run_loop.RunUntilIdle(); |
62 } | 67 } |
63 AppWindow* app_window = GetFirstAppWindow(); | 68 AppWindow* app_window = GetFirstAppWindow(); |
64 ASSERT_TRUE(app_window); | 69 ASSERT_TRUE(app_window); |
65 EXPECT_NE(std::string::npos, | 70 EXPECT_NE(std::string::npos, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 EXPECT_TRUE(RunPlatformAppTest( | 104 EXPECT_TRUE(RunPlatformAppTest( |
100 "platform_apps/windows_api_always_on_top/no_permissions")) << message_; | 105 "platform_apps/windows_api_always_on_top/no_permissions")) << message_; |
101 } | 106 } |
102 | 107 |
103 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiGet) { | 108 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiGet) { |
104 EXPECT_TRUE(RunPlatformAppTest("platform_apps/windows_api_get")) | 109 EXPECT_TRUE(RunPlatformAppTest("platform_apps/windows_api_get")) |
105 << message_; | 110 << message_; |
106 } | 111 } |
107 | 112 |
108 } // namespace extensions | 113 } // namespace extensions |
OLD | NEW |