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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 const char kTestFilePath[] = "platform_apps/launch_files/test.txt"; | 264 const char kTestFilePath[] = "platform_apps/launch_files/test.txt"; |
265 #endif | 265 #endif |
266 | 266 |
267 } // namespace | 267 } // namespace |
268 | 268 |
269 // Tests that CreateAppWindow doesn't crash if you close it straight away. | 269 // Tests that CreateAppWindow doesn't crash if you close it straight away. |
270 // LauncherPlatformAppBrowserTest relies on this behaviour, but is only run for | 270 // LauncherPlatformAppBrowserTest relies on this behaviour, but is only run for |
271 // ash, so we test that it works here. | 271 // ash, so we test that it works here. |
272 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, CreateAndCloseAppWindow) { | 272 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, CreateAndCloseAppWindow) { |
273 const Extension* extension = LoadAndLaunchPlatformApp("minimal", "Launched"); | 273 const Extension* extension = LoadAndLaunchPlatformApp("minimal", "Launched"); |
274 AppWindow* window = CreateAppWindow(extension); | 274 AppWindow* window = CreateAppWindow(browser()->profile(), extension); |
275 CloseAppWindow(window); | 275 CloseAppWindow(window); |
276 } | 276 } |
277 | 277 |
278 // Tests that platform apps received the "launch" event when launched. | 278 // Tests that platform apps received the "launch" event when launched. |
279 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OnLaunchedEvent) { | 279 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OnLaunchedEvent) { |
280 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch")) << message_; | 280 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch")) << message_; |
281 } | 281 } |
282 | 282 |
283 // Tests that platform apps cannot use certain disabled window properties, but | 283 // Tests that platform apps cannot use certain disabled window properties, but |
284 // can override them and then use them. | 284 // can override them and then use them. |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 #define MAYBE_AppWindowRestoreState AppWindowRestoreState | 764 #define MAYBE_AppWindowRestoreState AppWindowRestoreState |
765 #endif | 765 #endif |
766 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWindowRestoreState) { | 766 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWindowRestoreState) { |
767 ASSERT_TRUE(RunPlatformAppTest("platform_apps/restore_state")); | 767 ASSERT_TRUE(RunPlatformAppTest("platform_apps/restore_state")); |
768 } | 768 } |
769 | 769 |
770 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 770 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
771 AppWindowAdjustBoundsToBeVisibleOnScreen) { | 771 AppWindowAdjustBoundsToBeVisibleOnScreen) { |
772 const Extension* extension = LoadAndLaunchPlatformApp("minimal", "Launched"); | 772 const Extension* extension = LoadAndLaunchPlatformApp("minimal", "Launched"); |
773 | 773 |
774 AppWindow* window = CreateAppWindow(extension); | 774 AppWindow* window = CreateAppWindow(browser()->profile(), extension); |
775 | 775 |
776 // The screen bounds didn't change, the cached bounds didn't need to adjust. | 776 // The screen bounds didn't change, the cached bounds didn't need to adjust. |
777 gfx::Rect cached_bounds(80, 100, 400, 400); | 777 gfx::Rect cached_bounds(80, 100, 400, 400); |
778 gfx::Rect cached_screen_bounds(0, 0, 1600, 900); | 778 gfx::Rect cached_screen_bounds(0, 0, 1600, 900); |
779 gfx::Rect current_screen_bounds(0, 0, 1600, 900); | 779 gfx::Rect current_screen_bounds(0, 0, 1600, 900); |
780 gfx::Size minimum_size(200, 200); | 780 gfx::Size minimum_size(200, 200); |
781 gfx::Rect bounds; | 781 gfx::Rect bounds; |
782 CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window, | 782 CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window, |
783 cached_bounds, | 783 cached_bounds, |
784 cached_screen_bounds, | 784 cached_screen_bounds, |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 // Now check that the app window's default zoom, and actual zoom level, | 1371 // Now check that the app window's default zoom, and actual zoom level, |
1372 // have not been changed from the default. | 1372 // have not been changed from the default. |
1373 WebContents* web_contents = GetFirstAppWindowWebContents(); | 1373 WebContents* web_contents = GetFirstAppWindowWebContents(); |
1374 content::HostZoomMap* app_host_zoom_map = content::HostZoomMap::Get( | 1374 content::HostZoomMap* app_host_zoom_map = content::HostZoomMap::Get( |
1375 web_contents->GetSiteInstance()); | 1375 web_contents->GetSiteInstance()); |
1376 EXPECT_EQ(0, app_host_zoom_map->GetDefaultZoomLevel()); | 1376 EXPECT_EQ(0, app_host_zoom_map->GetDefaultZoomLevel()); |
1377 EXPECT_EQ(0, app_host_zoom_map->GetZoomLevel(web_contents)); | 1377 EXPECT_EQ(0, app_host_zoom_map->GetZoomLevel(web_contents)); |
1378 } | 1378 } |
1379 | 1379 |
1380 } // namespace extensions | 1380 } // namespace extensions |
OLD | NEW |