| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <memory> | 5 #include <memory> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "apps/test/app_window_waiter.h" | 8 #include "apps/test/app_window_waiter.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wallpaper/wallpaper_controller.h" | 10 #include "ash/wallpaper/wallpaper_controller.h" |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 extensions::AppWindowRegistry* app_window_registry = | 836 extensions::AppWindowRegistry* app_window_registry = |
| 837 extensions::AppWindowRegistry::Get(app_profile); | 837 extensions::AppWindowRegistry::Get(app_profile); |
| 838 extensions::AppWindow* window = | 838 extensions::AppWindow* window = |
| 839 apps::AppWindowWaiter(app_window_registry, test_app_id()).Wait(); | 839 apps::AppWindowWaiter(app_window_registry, test_app_id()).Wait(); |
| 840 ASSERT_TRUE(window); | 840 ASSERT_TRUE(window); |
| 841 | 841 |
| 842 // Gets the original width of the app window. | 842 // Gets the original width of the app window. |
| 843 int original_width; | 843 int original_width; |
| 844 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | 844 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( |
| 845 window->web_contents(), | 845 window->web_contents(), |
| 846 "window.domAutomationController.setAutomationId(0);" | |
| 847 "window.domAutomationController.send(window.innerWidth);", | 846 "window.domAutomationController.send(window.innerWidth);", |
| 848 &original_width)); | 847 &original_width)); |
| 849 | 848 |
| 850 native_app_window::NativeAppWindowViews* native_app_window_views = | 849 native_app_window::NativeAppWindowViews* native_app_window_views = |
| 851 static_cast<native_app_window::NativeAppWindowViews*>( | 850 static_cast<native_app_window::NativeAppWindowViews*>( |
| 852 window->GetBaseWindow()); | 851 window->GetBaseWindow()); |
| 853 ui::AcceleratorTarget* accelerator_target = | 852 ui::AcceleratorTarget* accelerator_target = |
| 854 static_cast<ui::AcceleratorTarget*>(native_app_window_views); | 853 static_cast<ui::AcceleratorTarget*>(native_app_window_views); |
| 855 | 854 |
| 856 // Zoom in. Text is bigger and content window width becomes smaller. | 855 // Zoom in. Text is bigger and content window width becomes smaller. |
| 857 accelerator_target->AcceleratorPressed(ui::Accelerator( | 856 accelerator_target->AcceleratorPressed(ui::Accelerator( |
| 858 ui::VKEY_ADD, ui::EF_CONTROL_DOWN)); | 857 ui::VKEY_ADD, ui::EF_CONTROL_DOWN)); |
| 859 int width_zoomed_in; | 858 int width_zoomed_in; |
| 860 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | 859 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( |
| 861 window->web_contents(), | 860 window->web_contents(), |
| 862 "window.domAutomationController.setAutomationId(0);" | |
| 863 "window.domAutomationController.send(window.innerWidth);", | 861 "window.domAutomationController.send(window.innerWidth);", |
| 864 &width_zoomed_in)); | 862 &width_zoomed_in)); |
| 865 DCHECK_LT(width_zoomed_in, original_width); | 863 DCHECK_LT(width_zoomed_in, original_width); |
| 866 | 864 |
| 867 // Go back to normal. Window width is restored. | 865 // Go back to normal. Window width is restored. |
| 868 accelerator_target->AcceleratorPressed(ui::Accelerator( | 866 accelerator_target->AcceleratorPressed(ui::Accelerator( |
| 869 ui::VKEY_0, ui::EF_CONTROL_DOWN)); | 867 ui::VKEY_0, ui::EF_CONTROL_DOWN)); |
| 870 int width_zoom_normal; | 868 int width_zoom_normal; |
| 871 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | 869 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( |
| 872 window->web_contents(), | 870 window->web_contents(), |
| 873 "window.domAutomationController.setAutomationId(0);" | |
| 874 "window.domAutomationController.send(window.innerWidth);", | 871 "window.domAutomationController.send(window.innerWidth);", |
| 875 &width_zoom_normal)); | 872 &width_zoom_normal)); |
| 876 DCHECK_EQ(width_zoom_normal, original_width); | 873 DCHECK_EQ(width_zoom_normal, original_width); |
| 877 | 874 |
| 878 // Zoom out. Text is smaller and content window width becomes larger. | 875 // Zoom out. Text is smaller and content window width becomes larger. |
| 879 accelerator_target->AcceleratorPressed(ui::Accelerator( | 876 accelerator_target->AcceleratorPressed(ui::Accelerator( |
| 880 ui::VKEY_SUBTRACT, ui::EF_CONTROL_DOWN)); | 877 ui::VKEY_SUBTRACT, ui::EF_CONTROL_DOWN)); |
| 881 int width_zoomed_out; | 878 int width_zoomed_out; |
| 882 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | 879 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( |
| 883 window->web_contents(), | 880 window->web_contents(), |
| 884 "window.domAutomationController.setAutomationId(0);" | |
| 885 "window.domAutomationController.send(window.innerWidth);", | 881 "window.domAutomationController.send(window.innerWidth);", |
| 886 &width_zoomed_out)); | 882 &width_zoomed_out)); |
| 887 DCHECK_GT(width_zoomed_out, original_width); | 883 DCHECK_GT(width_zoomed_out, original_width); |
| 888 | 884 |
| 889 // Terminate the app. | 885 // Terminate the app. |
| 890 window->GetBaseWindow()->Close(); | 886 window->GetBaseWindow()->Close(); |
| 891 content::RunAllPendingInMessageLoop(); | 887 content::RunAllPendingInMessageLoop(); |
| 892 } | 888 } |
| 893 | 889 |
| 894 IN_PROC_BROWSER_TEST_F(KioskTest, NotSignedInWithGAIAAccount) { | 890 IN_PROC_BROWSER_TEST_F(KioskTest, NotSignedInWithGAIAAccount) { |
| (...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 kTestEnterpriseKioskApp) | 2218 kTestEnterpriseKioskApp) |
| 2223 .Wait(); | 2219 .Wait(); |
| 2224 ASSERT_TRUE(window); | 2220 ASSERT_TRUE(window); |
| 2225 content::WaitForLoadStop(window->web_contents()); | 2221 content::WaitForLoadStop(window->web_contents()); |
| 2226 | 2222 |
| 2227 // Check whether the app can retrieve an OAuth2 access token. | 2223 // Check whether the app can retrieve an OAuth2 access token. |
| 2228 std::string result; | 2224 std::string result; |
| 2229 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 2225 EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
| 2230 window->web_contents(), | 2226 window->web_contents(), |
| 2231 "chrome.identity.getAuthToken({ 'interactive': false }, function(token) {" | 2227 "chrome.identity.getAuthToken({ 'interactive': false }, function(token) {" |
| 2232 " window.domAutomationController.setAutomationId(0);" | |
| 2233 " window.domAutomationController.send(token);" | 2228 " window.domAutomationController.send(token);" |
| 2234 "});", | 2229 "});", |
| 2235 &result)); | 2230 &result)); |
| 2236 EXPECT_EQ(kTestAccessToken, result); | 2231 EXPECT_EQ(kTestAccessToken, result); |
| 2237 | 2232 |
| 2238 // Verify that the session is not considered to be logged in with a GAIA | 2233 // Verify that the session is not considered to be logged in with a GAIA |
| 2239 // account. | 2234 // account. |
| 2240 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); | 2235 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
| 2241 ASSERT_TRUE(app_profile); | 2236 ASSERT_TRUE(app_profile); |
| 2242 EXPECT_FALSE( | 2237 EXPECT_FALSE( |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2361 content::WindowedNotificationObserver( | 2356 content::WindowedNotificationObserver( |
| 2362 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 2357 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 2363 content::NotificationService::AllSources()).Wait(); | 2358 content::NotificationService::AllSources()).Wait(); |
| 2364 | 2359 |
| 2365 // Wait for the wallpaper to load. | 2360 // Wait for the wallpaper to load. |
| 2366 WaitForWallpaper(); | 2361 WaitForWallpaper(); |
| 2367 EXPECT_TRUE(wallpaper_loaded()); | 2362 EXPECT_TRUE(wallpaper_loaded()); |
| 2368 } | 2363 } |
| 2369 | 2364 |
| 2370 } // namespace chromeos | 2365 } // namespace chromeos |
| OLD | NEW |