OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "apps/launcher.h" | 7 #include "apps/launcher.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 const char kTestFilePath[] = "platform_apps/launch_files/test.txt"; | 263 const char kTestFilePath[] = "platform_apps/launch_files/test.txt"; |
264 #endif | 264 #endif |
265 | 265 |
266 } // namespace | 266 } // namespace |
267 | 267 |
268 // Tests that CreateAppWindow doesn't crash if you close it straight away. | 268 // Tests that CreateAppWindow doesn't crash if you close it straight away. |
269 // LauncherPlatformAppBrowserTest relies on this behaviour, but is only run for | 269 // LauncherPlatformAppBrowserTest relies on this behaviour, but is only run for |
270 // ash, so we test that it works here. | 270 // ash, so we test that it works here. |
271 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, CreateAndCloseAppWindow) { | 271 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, CreateAndCloseAppWindow) { |
272 const Extension* extension = LoadAndLaunchPlatformApp("minimal", "Launched"); | 272 const Extension* extension = LoadAndLaunchPlatformApp("minimal", "Launched"); |
273 AppWindow* window = CreateAppWindow(extension); | 273 AppWindow* window = |
| 274 CreateAppWindow(extension, GetFirstAppWindowWebContents()); |
274 CloseAppWindow(window); | 275 CloseAppWindow(window); |
275 } | 276 } |
276 | 277 |
277 // Tests that platform apps received the "launch" event when launched. | 278 // Tests that platform apps received the "launch" event when launched. |
278 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OnLaunchedEvent) { | 279 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OnLaunchedEvent) { |
279 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch")) << message_; | 280 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch")) << message_; |
280 } | 281 } |
281 | 282 |
282 // Tests that platform apps cannot use certain disabled window properties, but | 283 // Tests that platform apps cannot use certain disabled window properties, but |
283 // can override them and then use them. | 284 // can override them and then use them. |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 #define MAYBE_AppWindowRestoreState AppWindowRestoreState | 754 #define MAYBE_AppWindowRestoreState AppWindowRestoreState |
754 #endif | 755 #endif |
755 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWindowRestoreState) { | 756 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWindowRestoreState) { |
756 ASSERT_TRUE(RunPlatformAppTest("platform_apps/restore_state")); | 757 ASSERT_TRUE(RunPlatformAppTest("platform_apps/restore_state")); |
757 } | 758 } |
758 | 759 |
759 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 760 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
760 AppWindowAdjustBoundsToBeVisibleOnScreen) { | 761 AppWindowAdjustBoundsToBeVisibleOnScreen) { |
761 const Extension* extension = LoadAndLaunchPlatformApp("minimal", "Launched"); | 762 const Extension* extension = LoadAndLaunchPlatformApp("minimal", "Launched"); |
762 | 763 |
763 AppWindow* window = CreateAppWindow(extension); | 764 AppWindow* window = |
| 765 CreateAppWindow(extension, GetFirstAppWindowWebContents()); |
764 | 766 |
765 // The screen bounds didn't change, the cached bounds didn't need to adjust. | 767 // The screen bounds didn't change, the cached bounds didn't need to adjust. |
766 gfx::Rect cached_bounds(80, 100, 400, 400); | 768 gfx::Rect cached_bounds(80, 100, 400, 400); |
767 gfx::Rect cached_screen_bounds(0, 0, 1600, 900); | 769 gfx::Rect cached_screen_bounds(0, 0, 1600, 900); |
768 gfx::Rect current_screen_bounds(0, 0, 1600, 900); | 770 gfx::Rect current_screen_bounds(0, 0, 1600, 900); |
769 gfx::Size minimum_size(200, 200); | 771 gfx::Size minimum_size(200, 200); |
770 gfx::Rect bounds; | 772 gfx::Rect bounds; |
771 CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window, | 773 CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window, |
772 cached_bounds, | 774 cached_bounds, |
773 cached_screen_bounds, | 775 cached_screen_bounds, |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 // Now check that the app window's default zoom, and actual zoom level, | 1362 // Now check that the app window's default zoom, and actual zoom level, |
1361 // have not been changed from the default. | 1363 // have not been changed from the default. |
1362 WebContents* web_contents = GetFirstAppWindowWebContents(); | 1364 WebContents* web_contents = GetFirstAppWindowWebContents(); |
1363 content::HostZoomMap* app_host_zoom_map = content::HostZoomMap::Get( | 1365 content::HostZoomMap* app_host_zoom_map = content::HostZoomMap::Get( |
1364 web_contents->GetSiteInstance()); | 1366 web_contents->GetSiteInstance()); |
1365 EXPECT_EQ(0, app_host_zoom_map->GetDefaultZoomLevel()); | 1367 EXPECT_EQ(0, app_host_zoom_map->GetDefaultZoomLevel()); |
1366 EXPECT_EQ(0, app_host_zoom_map->GetZoomLevel(web_contents)); | 1368 EXPECT_EQ(0, app_host_zoom_map->GetZoomLevel(web_contents)); |
1367 } | 1369 } |
1368 | 1370 |
1369 } // namespace extensions | 1371 } // namespace extensions |
OLD | NEW |