diff options
Diffstat (limited to 'chrome/browser/apps')
-rw-r--r-- | chrome/browser/apps/app_browsertest.cc | 167 | ||||
-rw-r--r-- | chrome/browser/apps/app_browsertest_util.cc | 79 | ||||
-rw-r--r-- | chrome/browser/apps/app_browsertest_util.h | 41 | ||||
-rw-r--r-- | chrome/browser/apps/app_pointer_lock_interactive_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/apps/app_url_redirector_browsertest.cc | 24 | ||||
-rw-r--r-- | chrome/browser/apps/app_window_browsertest.cc | 28 | ||||
-rw-r--r-- | chrome/browser/apps/app_window_interactive_uitest.cc | 36 | ||||
-rw-r--r-- | chrome/browser/apps/ephemeral_app_browsertest.cc | 8 | ||||
-rw-r--r-- | chrome/browser/apps/event_page_browsertest.cc | 8 | ||||
-rw-r--r-- | chrome/browser/apps/web_view_browsertest.cc | 25 | ||||
-rw-r--r-- | chrome/browser/apps/web_view_interactive_browsertest.cc | 28 |
11 files changed, 220 insertions, 226 deletions
diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc index baac724..8ac50ed 100644 --- a/chrome/browser/apps/app_browsertest.cc +++ b/chrome/browser/apps/app_browsertest.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "apps/app_window.h" +#include "apps/app_window_registry.h" #include "apps/launcher.h" -#include "apps/shell_window.h" -#include "apps/shell_window_registry.h" #include "apps/ui/native_app_window.h" #include "base/bind.h" #include "base/command_line.h" @@ -56,8 +56,8 @@ #include "chromeos/dbus/fake_power_manager_client.h" #endif -using apps::ShellWindow; -using apps::ShellWindowRegistry; +using apps::AppWindow; +using apps::AppWindowRegistry; using content::WebContents; using web_modal::WebContentsModalDialogManager; @@ -196,13 +196,13 @@ const char kTestFilePath[] = "platform_apps/launch_files/test.txt"; } // namespace -// Tests that CreateShellWindow doesn't crash if you close it straight away. +// Tests that CreateAppWindow doesn't crash if you close it straight away. // LauncherPlatformAppBrowserTest relies on this behaviour, but is only run for // ash, so we test that it works here. -IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, CreateAndCloseShellWindow) { +IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, CreateAndCloseAppWindow) { const Extension* extension = LoadAndLaunchPlatformApp("minimal"); - ShellWindow* window = CreateShellWindow(extension); - CloseShellWindow(window); + AppWindow* window = CreateAppWindow(extension); + CloseAppWindow(window); } // Tests that platform apps received the "launch" event when launched. @@ -225,7 +225,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, EmptyContextMenu) { // The empty app doesn't add any context menu items, so its menu should // only include the developer tools. - WebContents* web_contents = GetFirstShellWindowWebContents(); + WebContents* web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(web_contents); content::ContextMenuParams params; scoped_ptr<PlatformAppContextMenu> menu; @@ -249,7 +249,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) { // The context_menu app has two context menu items. These, along with a // separator and the developer tools, is all that should be in the menu. - WebContents* web_contents = GetFirstShellWindowWebContents(); + WebContents* web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(web_contents); content::ContextMenuParams params; scoped_ptr<PlatformAppContextMenu> menu; @@ -276,7 +276,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, InstalledAppWithContextMenu) { // The context_menu app has two context menu items. For an installed app // these are all that should be in the menu. - WebContents* web_contents = GetFirstShellWindowWebContents(); + WebContents* web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(web_contents); content::ContextMenuParams params; scoped_ptr<PlatformAppContextMenu> menu; @@ -303,7 +303,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuTextField) { // The context_menu app has one context menu item. This, along with a // separator and the developer tools, is all that should be in the menu. - WebContents* web_contents = GetFirstShellWindowWebContents(); + WebContents* web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(web_contents); content::ContextMenuParams params; params.is_editable = true; @@ -331,7 +331,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuSelection) { // The context_menu app has one context menu item. This, along with a // separator and the developer tools, is all that should be in the menu. - WebContents* web_contents = GetFirstShellWindowWebContents(); + WebContents* web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(web_contents); content::ContextMenuParams params; params.selection_text = base::ASCIIToUTF16("Hello World"); @@ -358,7 +358,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuClicked) { ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); // Test that the menu item shows up - WebContents* web_contents = GetFirstShellWindowWebContents(); + WebContents* web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(web_contents); content::ContextMenuParams params; params.page_url = GURL("http://foo.bar"); @@ -461,33 +461,33 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ExtensionWindowingApis) { test_data_dir_.AppendASCII("common/background_page")); ASSERT_EQ(1U, RunGetWindowsFunctionForExtension(extension)); - // And no shell windows. - ASSERT_EQ(0U, GetShellWindowCount()); + // And no app windows. + ASSERT_EQ(0U, GetAppWindowCount()); // Launch a platform app that shows a window. ExtensionTestMessageListener launched_listener("Launched", false); LoadAndLaunchPlatformApp("minimal"); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); - ASSERT_EQ(1U, GetShellWindowCount()); - int shell_window_id = GetFirstShellWindow()->session_id().id(); + ASSERT_EQ(1U, GetAppWindowCount()); + int app_window_id = GetFirstAppWindow()->session_id().id(); // But it's not visible to the extensions API, it still thinks there's just // one browser window. ASSERT_EQ(1U, RunGetWindowsFunctionForExtension(extension)); // It can't look it up by ID either - ASSERT_FALSE(RunGetWindowFunctionForExtension(shell_window_id, extension)); + ASSERT_FALSE(RunGetWindowFunctionForExtension(app_window_id, extension)); // The app can also only see one window (its own). - // TODO(jeremya): add an extension function to get a shell window by ID, and - // to get a list of all the shell windows, so we can test this. + // TODO(jeremya): add an extension function to get an app window by ID, and + // to get a list of all the app windows, so we can test this. // Launch another platform app that also shows a window. ExtensionTestMessageListener launched_listener2("Launched", false); LoadAndLaunchPlatformApp("context_menu"); ASSERT_TRUE(launched_listener2.WaitUntilSatisfied()); - // There are two total shell windows, but each app can only see its own. - ASSERT_EQ(2U, GetShellWindowCount()); + // There are two total app windows, but each app can only see its own. + ASSERT_EQ(2U, GetAppWindowCount()); // TODO(jeremya): as above, this requires more extension functions. } @@ -715,19 +715,18 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MutationEventsDisabled) { // This appears to be unreliable on linux. // TODO(stevenjb): Investigate and enable #if defined(OS_LINUX) && !defined(USE_ASH) -#define MAYBE_ShellWindowRestoreState DISABLED_ShellWindowRestoreState +#define MAYBE_AppWindowRestoreState DISABLED_AppWindowRestoreState #else -#define MAYBE_ShellWindowRestoreState ShellWindowRestoreState +#define MAYBE_AppWindowRestoreState AppWindowRestoreState #endif -IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, - MAYBE_ShellWindowRestoreState) { +IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWindowRestoreState) { ASSERT_TRUE(RunPlatformAppTest("platform_apps/restore_state")); } IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, - ShellWindowAdjustBoundsToBeVisibleOnScreen) { + AppWindowAdjustBoundsToBeVisibleOnScreen) { const Extension* extension = LoadAndLaunchPlatformApp("minimal"); - ShellWindow* window = CreateShellWindow(extension); + AppWindow* window = CreateAppWindow(extension); // The screen bounds didn't change, the cached bounds didn't need to adjust. gfx::Rect cached_bounds(80, 100, 400, 400); @@ -735,28 +734,28 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, gfx::Rect current_screen_bounds(0, 0, 1600, 900); gfx::Size minimum_size(200, 200); gfx::Rect bounds; - CallAdjustBoundsToBeVisibleOnScreenForShellWindow(window, - cached_bounds, - cached_screen_bounds, - current_screen_bounds, - minimum_size, - &bounds); + CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window, + cached_bounds, + cached_screen_bounds, + current_screen_bounds, + minimum_size, + &bounds); EXPECT_EQ(bounds, cached_bounds); // We have an empty screen bounds, the cached bounds didn't need to adjust. gfx::Rect empty_screen_bounds; - CallAdjustBoundsToBeVisibleOnScreenForShellWindow(window, - cached_bounds, - empty_screen_bounds, - current_screen_bounds, - minimum_size, - &bounds); + CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window, + cached_bounds, + empty_screen_bounds, + current_screen_bounds, + minimum_size, + &bounds); EXPECT_EQ(bounds, cached_bounds); // Cached bounds is completely off the new screen bounds in horizontal // locations. Expect to reposition the bounds. gfx::Rect horizontal_out_of_screen_bounds(-800, 100, 400, 400); - CallAdjustBoundsToBeVisibleOnScreenForShellWindow( + CallAdjustBoundsToBeVisibleOnScreenForAppWindow( window, horizontal_out_of_screen_bounds, gfx::Rect(-1366, 0, 1600, 900), @@ -768,7 +767,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, // Cached bounds is completely off the new screen bounds in vertical // locations. Expect to reposition the bounds. gfx::Rect vertical_out_of_screen_bounds(10, 1000, 400, 400); - CallAdjustBoundsToBeVisibleOnScreenForShellWindow( + CallAdjustBoundsToBeVisibleOnScreenForAppWindow( window, vertical_out_of_screen_bounds, gfx::Rect(-1366, 0, 1600, 900), @@ -779,24 +778,22 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, // From a large screen resulotion to a small one. Expect it fit on screen. gfx::Rect big_cache_bounds(10, 10, 1000, 1000); - CallAdjustBoundsToBeVisibleOnScreenForShellWindow( - window, - big_cache_bounds, - gfx::Rect(0, 0, 1600, 1000), - gfx::Rect(0, 0, 800, 600), - minimum_size, - &bounds); + CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window, + big_cache_bounds, + gfx::Rect(0, 0, 1600, 1000), + gfx::Rect(0, 0, 800, 600), + minimum_size, + &bounds); EXPECT_EQ(bounds, gfx::Rect(0, 0, 800, 600)); // Don't resize the bounds smaller than minimum size, when the minimum size is // larger than the screen. - CallAdjustBoundsToBeVisibleOnScreenForShellWindow( - window, - big_cache_bounds, - gfx::Rect(0, 0, 1600, 1000), - gfx::Rect(0, 0, 800, 600), - gfx::Size(900, 900), - &bounds); + CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window, + big_cache_bounds, + gfx::Rect(0, 0, 1600, 1000), + gfx::Rect(0, 0, 800, 600), + gfx::Size(900, 900), + &bounds); EXPECT_EQ(bounds, gfx::Rect(0, 0, 900, 900)); } @@ -808,7 +805,7 @@ class PlatformAppDevToolsBrowserTest : public PlatformAppBrowserTest { RELAUNCH = 0x1, HAS_ID = 0x2, }; - // Runs a test inside a harness that opens DevTools on a shell window. + // Runs a test inside a harness that opens DevTools on an app window. void RunTestWithDevTools(const char* name, int test_flags); }; @@ -819,30 +816,30 @@ void PlatformAppDevToolsBrowserTest::RunTestWithDevTools( const Extension* extension = LoadAndLaunchPlatformApp(name); ASSERT_TRUE(extension); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); - ShellWindow* window = GetFirstShellWindow(); + AppWindow* window = GetFirstAppWindow(); ASSERT_TRUE(window); ASSERT_EQ(window->window_key().empty(), (test_flags & HAS_ID) == 0); content::RenderViewHost* rvh = window->web_contents()->GetRenderViewHost(); ASSERT_TRUE(rvh); - // Ensure no DevTools open for the ShellWindow, then open one. + // Ensure no DevTools open for the AppWindow, then open one. ASSERT_FALSE(DevToolsAgentHost::HasFor(rvh)); DevToolsWindow::OpenDevToolsWindow(rvh); ASSERT_TRUE(DevToolsAgentHost::HasFor(rvh)); if (test_flags & RELAUNCH) { - // Close the ShellWindow, and ensure it is gone. - CloseShellWindow(window); - ASSERT_FALSE(GetFirstShellWindow()); + // Close the AppWindow, and ensure it is gone. + CloseAppWindow(window); + ASSERT_FALSE(GetFirstAppWindow()); - // Relaunch the app and get a new ShellWindow. + // Relaunch the app and get a new AppWindow. content::WindowedNotificationObserver app_loaded_observer( content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, content::NotificationService::AllSources()); OpenApplication(AppLaunchParams( browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); app_loaded_observer.Wait(); - window = GetFirstShellWindow(); + window = GetFirstAppWindow(); ASSERT_TRUE(window); // DevTools should have reopened with the relaunch. @@ -895,10 +892,10 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ConstrainedWindowRequest) { LoadAndLaunchPlatformApp("optional_permission_request"); ASSERT_TRUE(extension) << "Failed to load extension."; - WebContents* web_contents = GetFirstShellWindowWebContents(); + WebContents* web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(web_contents); - // Verify that the shell window has a dialog attached. + // Verify that the app window has a dialog attached. WebContentsModalDialogManager* web_contents_modal_dialog_manager = WebContentsModalDialogManager::FromWebContents(web_contents); EXPECT_TRUE(web_contents_modal_dialog_manager->IsDialogActive()); @@ -919,13 +916,13 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ReloadRelaunches) { const Extension* extension = LoadAndLaunchPlatformApp("reload"); ASSERT_TRUE(extension); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); - ASSERT_TRUE(GetFirstShellWindow()); + ASSERT_TRUE(GetFirstAppWindow()); // Now tell the app to reload itself ExtensionTestMessageListener launched_listener2("Launched", false); launched_listener.Reply("reload"); ASSERT_TRUE(launched_listener2.WaitUntilSatisfied()); - ASSERT_TRUE(GetFirstShellWindow()); + ASSERT_TRUE(GetFirstAppWindow()); } namespace { @@ -962,7 +959,7 @@ class CheckExtensionInstalledObserver : public content::NotificationObserver { // Component App Test 1 of 3: ensure that the initial load of a component // extension utilizing a background page (e.g. a v2 platform app) has its // background page run and is launchable. Waits for the Launched response from -// the script resource in the opened shell window. +// the script resource in the opened app window. IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, PRE_PRE_ComponentAppBackgroundPage) { CheckExtensionInstalledObserver should_install; @@ -1076,9 +1073,11 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) { LoadAndLaunchPlatformApp("minimal"); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); - EXPECT_EQ(1LU, GetShellWindowCount()); - EXPECT_TRUE(GetFirstShellWindow()->web_contents()-> - GetRenderWidgetHostView()->HasFocus()); + EXPECT_EQ(1LU, GetAppWindowCount()); + EXPECT_TRUE(GetFirstAppWindow() + ->web_contents() + ->GetRenderWidgetHostView() + ->HasFocus()); } // The next three tests will only run automatically with Chrome branded builds @@ -1126,7 +1125,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ScopedPreviewTestingDelegate preview_delegate(false); ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; preview_delegate.WaitUntilPreviewIsReady(); - GetFirstShellWindow()->GetBaseWindow()->Close(); + GetFirstAppWindow()->GetBaseWindow()->Close(); } // This test currently only passes on OS X (on other platforms the print preview @@ -1152,14 +1151,14 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, minimum_dialog_size.width()); EXPECT_GE(preview_delegate.dialog_size().height(), minimum_dialog_size.height()); - GetFirstShellWindow()->GetBaseWindow()->Close(); + GetFirstAppWindow()->GetBaseWindow()->Close(); } #if defined(OS_CHROMEOS) class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest, - public ShellWindowRegistry::Observer { + public AppWindowRegistry::Observer { public: virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { // Tell chromeos to launch in Guest mode, aka incognito. @@ -1172,15 +1171,15 @@ class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest, PlatformAppBrowserTest::SetUp(); } - // ShellWindowRegistry::Observer implementation. - virtual void OnShellWindowAdded(ShellWindow* shell_window) OVERRIDE { - opener_app_ids_.insert(shell_window->extension()->id()); + // AppWindowRegistry::Observer implementation. + virtual void OnAppWindowAdded(AppWindow* app_window) OVERRIDE { + opener_app_ids_.insert(app_window->extension()->id()); } - virtual void OnShellWindowIconChanged(ShellWindow* shell_window) OVERRIDE {} - virtual void OnShellWindowRemoved(ShellWindow* shell_window) OVERRIDE {} + virtual void OnAppWindowIconChanged(AppWindow* app_window) OVERRIDE {} + virtual void OnAppWindowRemoved(AppWindow* app_window) OVERRIDE {} protected: - // A set of ids of apps we've seen open a shell window. + // A set of ids of apps we've seen open a app window. std::set<std::string> opener_app_ids_; }; @@ -1201,8 +1200,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppIncognitoBrowserTest, IncognitoComponentApp) { content::RunAllPendingInMessageLoop(); } - // Listen for new shell windows so we see the file manager app launch itself. - ShellWindowRegistry* registry = ShellWindowRegistry::Get(incognito_profile); + // Listen for new app windows so we see the file manager app launch itself. + AppWindowRegistry* registry = AppWindowRegistry::Get(incognito_profile); ASSERT_TRUE(registry != NULL); registry->AddObserver(this); diff --git a/chrome/browser/apps/app_browsertest_util.cc b/chrome/browser/apps/app_browsertest_util.cc index e2fa045..69479e1 100644 --- a/chrome/browser/apps/app_browsertest_util.cc +++ b/chrome/browser/apps/app_browsertest_util.cc @@ -5,7 +5,7 @@ #include "chrome/browser/apps/app_browsertest_util.h" #include "apps/app_window_contents.h" -#include "apps/shell_window_registry.h" +#include "apps/app_window_registry.h" #include "apps/ui/native_app_window.h" #include "base/command_line.h" #include "base/strings/stringprintf.h" @@ -19,8 +19,8 @@ #include "content/public/test/test_utils.h" #include "extensions/common/switches.h" -using apps::ShellWindow; -using apps::ShellWindowRegistry; +using apps::AppWindow; +using apps::AppWindowRegistry; using content::WebContents; namespace utils = extension_function_test_utils; @@ -41,15 +41,14 @@ void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) { } // static -ShellWindow* PlatformAppBrowserTest::GetFirstShellWindowForBrowser( +AppWindow* PlatformAppBrowserTest::GetFirstAppWindowForBrowser( Browser* browser) { - ShellWindowRegistry* app_registry = - ShellWindowRegistry::Get(browser->profile()); - const ShellWindowRegistry::ShellWindowList& shell_windows = - app_registry->shell_windows(); + AppWindowRegistry* app_registry = AppWindowRegistry::Get(browser->profile()); + const AppWindowRegistry::AppWindowList& app_windows = + app_registry->app_windows(); - ShellWindowRegistry::const_iterator iter = shell_windows.begin(); - if (iter != shell_windows.end()) + AppWindowRegistry::const_iterator iter = app_windows.begin(); + if (iter != app_windows.end()) return *iter; return NULL; @@ -101,27 +100,27 @@ void PlatformAppBrowserTest::LaunchPlatformApp(const Extension* extension) { browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); } -WebContents* PlatformAppBrowserTest::GetFirstShellWindowWebContents() { - ShellWindow* window = GetFirstShellWindow(); +WebContents* PlatformAppBrowserTest::GetFirstAppWindowWebContents() { + AppWindow* window = GetFirstAppWindow(); if (window) return window->web_contents(); return NULL; } -ShellWindow* PlatformAppBrowserTest::GetFirstShellWindow() { - return GetFirstShellWindowForBrowser(browser()); +AppWindow* PlatformAppBrowserTest::GetFirstAppWindow() { + return GetFirstAppWindowForBrowser(browser()); } -apps::ShellWindow* PlatformAppBrowserTest::GetFirstShellWindowForApp( +apps::AppWindow* PlatformAppBrowserTest::GetFirstAppWindowForApp( const std::string& app_id) { - ShellWindowRegistry* app_registry = - ShellWindowRegistry::Get(browser()->profile()); - const ShellWindowRegistry::ShellWindowList& shell_windows = - app_registry->GetShellWindowsForApp(app_id); + AppWindowRegistry* app_registry = + AppWindowRegistry::Get(browser()->profile()); + const AppWindowRegistry::AppWindowList& app_windows = + app_registry->GetAppWindowsForApp(app_id); - ShellWindowRegistry::const_iterator iter = shell_windows.begin(); - if (iter != shell_windows.end()) + AppWindowRegistry::const_iterator iter = app_windows.begin(); + if (iter != app_windows.end()) return *iter; return NULL; @@ -151,15 +150,15 @@ bool PlatformAppBrowserTest::RunGetWindowFunctionForExtension( return function->GetResultList() != NULL; } -size_t PlatformAppBrowserTest::GetShellWindowCount() { - return ShellWindowRegistry::Get(browser()->profile())-> - shell_windows().size(); +size_t PlatformAppBrowserTest::GetAppWindowCount() { + return AppWindowRegistry::Get(browser()->profile())->app_windows().size(); } -size_t PlatformAppBrowserTest::GetShellWindowCountForApp( +size_t PlatformAppBrowserTest::GetAppWindowCountForApp( const std::string& app_id) { - return ShellWindowRegistry::Get(browser()->profile())-> - GetShellWindowsForApp(app_id).size(); + return AppWindowRegistry::Get(browser()->profile()) + ->GetAppWindowsForApp(app_id) + .size(); } void PlatformAppBrowserTest::ClearCommandLineArgs() { @@ -179,31 +178,29 @@ void PlatformAppBrowserTest::SetCommandLineArg(const std::string& test_file) { command_line->AppendArgPath(test_doc); } -ShellWindow* PlatformAppBrowserTest::CreateShellWindow( - const Extension* extension) { - return CreateShellWindowFromParams(extension, ShellWindow::CreateParams()); +AppWindow* PlatformAppBrowserTest::CreateAppWindow(const Extension* extension) { + return CreateAppWindowFromParams(extension, AppWindow::CreateParams()); } -ShellWindow* PlatformAppBrowserTest::CreateShellWindowFromParams( - const Extension* extension, const ShellWindow::CreateParams& params) { - ShellWindow* window = new ShellWindow(browser()->profile(), - new ChromeShellWindowDelegate(), - extension); - window->Init(GURL(std::string()), - new apps::AppWindowContents(window), - params); +AppWindow* PlatformAppBrowserTest::CreateAppWindowFromParams( + const Extension* extension, + const AppWindow::CreateParams& params) { + AppWindow* window = new AppWindow( + browser()->profile(), new ChromeShellWindowDelegate(), extension); + window->Init( + GURL(std::string()), new apps::AppWindowContentsImpl(window), params); return window; } -void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { +void PlatformAppBrowserTest::CloseAppWindow(AppWindow* window) { content::WebContentsDestroyedWatcher destroyed_watcher( window->web_contents()); window->GetBaseWindow()->Close(); destroyed_watcher.Wait(); } -void PlatformAppBrowserTest::CallAdjustBoundsToBeVisibleOnScreenForShellWindow( - ShellWindow* window, +void PlatformAppBrowserTest::CallAdjustBoundsToBeVisibleOnScreenForAppWindow( + AppWindow* window, const gfx::Rect& cached_bounds, const gfx::Rect& cached_screen_bounds, const gfx::Rect& current_screen_bounds, diff --git a/chrome/browser/apps/app_browsertest_util.h b/chrome/browser/apps/app_browsertest_util.h index e322fc0..41e883f 100644 --- a/chrome/browser/apps/app_browsertest_util.h +++ b/chrome/browser/apps/app_browsertest_util.h @@ -5,8 +5,7 @@ #ifndef CHROME_BROWSER_APPS_APP_BROWSERTEST_UTIL_H_ #define CHROME_BROWSER_APPS_APP_BROWSERTEST_UTIL_H_ - -#include "apps/shell_window.h" +#include "apps/app_window.h" #include "chrome/browser/extensions/extension_apitest.h" #include "content/public/common/page_transition_types.h" @@ -26,8 +25,8 @@ class PlatformAppBrowserTest : public ExtensionApiTest { virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; - // Gets the first shell window that is found for a given browser. - static apps::ShellWindow* GetFirstShellWindowForBrowser(Browser* browser); + // Gets the first app window that is found for a given browser. + static apps::AppWindow* GetFirstAppWindowForBrowser(Browser* browser); protected: // Runs the app named |name| out of the platform_apps subdirectory. Waits @@ -44,17 +43,17 @@ class PlatformAppBrowserTest : public ExtensionApiTest { // Launch the given platform app. void LaunchPlatformApp(const Extension* extension); - // Gets the WebContents associated with the first shell window that is found + // Gets the WebContents associated with the first app window that is found // (most tests only deal with one platform app window, so this is good // enough). - content::WebContents* GetFirstShellWindowWebContents(); + content::WebContents* GetFirstAppWindowWebContents(); - // Gets the first shell window that is found (most tests only deal with one + // Gets the first app window that is found (most tests only deal with one // platform app window, so this is good enough). - apps::ShellWindow* GetFirstShellWindow(); + apps::AppWindow* GetFirstAppWindow(); - // Gets the first shell window for an app. - apps::ShellWindow* GetFirstShellWindowForApp(const std::string& app_id); + // Gets the first app window for an app. + apps::AppWindow* GetFirstAppWindowForApp(const std::string& app_id); // Runs chrome.windows.getAll for the given extension and returns the number // of windows that the function returns. @@ -65,11 +64,11 @@ class PlatformAppBrowserTest : public ExtensionApiTest { bool RunGetWindowFunctionForExtension(int window_id, const Extension* extension); - // Returns the number of shell windows. - size_t GetShellWindowCount(); + // Returns the number of app windows. + size_t GetAppWindowCount(); - // Returns the number of shell windows for a specific app. - size_t GetShellWindowCountForApp(const std::string& app_id); + // Returns the number of app windows for a specific app. + size_t GetAppWindowCountForApp(const std::string& app_id); // The command line already has an argument on it - about:blank, which // is set by InProcessBrowserTest::PrepareTestCommandLine. For platform app @@ -79,19 +78,19 @@ class PlatformAppBrowserTest : public ExtensionApiTest { // Sets up the command line for running platform apps. void SetCommandLineArg(const std::string& test_file); - // Creates an empty shell window for |extension|. - apps::ShellWindow* CreateShellWindow(const Extension* extension); + // Creates an empty app window for |extension|. + apps::AppWindow* CreateAppWindow(const Extension* extension); - apps::ShellWindow* CreateShellWindowFromParams( + apps::AppWindow* CreateAppWindowFromParams( const Extension* extension, - const apps::ShellWindow::CreateParams& params); + const apps::AppWindow::CreateParams& params); // Closes |window| and waits until it's gone. - void CloseShellWindow(apps::ShellWindow* window); + void CloseAppWindow(apps::AppWindow* window); // Call AdjustBoundsToBeVisibleOnScreen of |window|. - void CallAdjustBoundsToBeVisibleOnScreenForShellWindow( - apps::ShellWindow* window, + void CallAdjustBoundsToBeVisibleOnScreenForAppWindow( + apps::AppWindow* window, const gfx::Rect& cached_bounds, const gfx::Rect& cached_screen_bounds, const gfx::Rect& current_screen_bounds, diff --git a/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc b/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc index f849c81..401b738 100644 --- a/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc +++ b/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc @@ -20,7 +20,7 @@ class ExtensionPointerLockTest : public extensions::PlatformAppBrowserTest { ResultCatcher catcher; if (!ui_test_utils::ShowAndFocusNativeWindow( - GetFirstShellWindow()->GetNativeWindow())) { + GetFirstAppWindow()->GetNativeWindow())) { message_ = "Can't focus window"; return false; } diff --git a/chrome/browser/apps/app_url_redirector_browsertest.cc b/chrome/browser/apps/app_url_redirector_browsertest.cc index dd5a4bc..eabb5a6 100644 --- a/chrome/browser/apps/app_url_redirector_browsertest.cc +++ b/chrome/browser/apps/app_url_redirector_browsertest.cc @@ -28,7 +28,7 @@ class PlatformAppUrlRedirectorBrowserTest : public PlatformAppBrowserTest { // subdirectory); // - navigates the current tab to the HTML page |lancher_page| (ditto); // - then waits for |handler| to launch and send back a |handler_ack_message|; - // - finally checks that the resulting shell window count is as expected. + // - finally checks that the resulting app window count is as expected. // The |launcher_page| is supposed to trigger a navigation matching one of the // url_handlers in the |handler|'s manifest, and thereby launch the |handler|. void TestNavigationInTab(const char* launcher_page, @@ -47,7 +47,7 @@ class PlatformAppUrlRedirectorBrowserTest : public PlatformAppBrowserTest { // url_handlers in |handler|; // - waits until |xhr_opening_page| gets a response back and changes the tab's // title to a value indicating success/failure of the XHR; - // - verifies that no shell windows have been opened, i.e. |handler| wasn't + // - verifies that no app windows have been opened, i.e. |handler| wasn't // launched even though its url_handlers match the URL. void TestNegativeXhrInTab(const char* xhr_opening_page, const char* success_tab_title, @@ -61,7 +61,7 @@ class PlatformAppUrlRedirectorBrowserTest : public PlatformAppBrowserTest { // - waits for the |launcher| to launch and send back a |launcher_ack_message| // (to make sure it's not the failing entity, if the test fails overall); // - waits for the |handler| to launch and send back a |handler_ack_message|; - // - finally checks that the resulting shell window count is as expected. + // - finally checks that the resulting app window count is as expected. // The |launcher| is supposed to trigger a navigation matching one of the // url_handlers in the |handler|'s manifest, and thereby launch the |handler|. void TestNavigationInApp(const char* launcher, @@ -90,7 +90,7 @@ class PlatformAppUrlRedirectorBrowserTest : public PlatformAppBrowserTest { // - navigates the current tab to the HTML page |matching_target_page| with // page transition |transition|; // - waits for |handler| to launch and send back a |handler_start_message|; - // - finally checks that the resulting shell window count is as expected. + // - finally checks that the resulting app window count is as expected. void TestNavigationInBrowser(const char* matching_target_page, content::PageTransition transition, const char* handler, @@ -144,7 +144,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNavigationInTab( ASSERT_TRUE(handler_listener.WaitUntilSatisfied()); - ASSERT_EQ(1U, GetShellWindowCount()); + ASSERT_EQ(1U, GetAppWindowCount()); } void PlatformAppUrlRedirectorBrowserTest::TestMismatchingNavigationInTab( @@ -169,7 +169,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestMismatchingNavigationInTab( ASSERT_EQ(success_title, title_watcher.WaitAndGetTitle()); ASSERT_EQ(1, browser()->tab_strip_model()->count()); - ASSERT_EQ(0U, GetShellWindowCount()); + ASSERT_EQ(0U, GetAppWindowCount()); } void PlatformAppUrlRedirectorBrowserTest::TestNegativeXhrInTab( @@ -197,7 +197,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNegativeXhrInTab( ASSERT_EQ(success_title, title_watcher.WaitAndGetTitle()); ASSERT_EQ(1, browser()->tab_strip_model()->count()); - ASSERT_EQ(0U, GetShellWindowCount()); + ASSERT_EQ(0U, GetAppWindowCount()); } void PlatformAppUrlRedirectorBrowserTest::TestNavigationInApp( @@ -217,7 +217,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNavigationInApp( ASSERT_TRUE(launcher_listener.WaitUntilSatisfied()); ASSERT_TRUE(handler_listener.WaitUntilSatisfied()); - ASSERT_EQ(2U, GetShellWindowCount()); + ASSERT_EQ(2U, GetAppWindowCount()); } void PlatformAppUrlRedirectorBrowserTest::TestNegativeNavigationInApp( @@ -240,7 +240,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNegativeNavigationInApp( observer.Wait(); - ASSERT_EQ(1U, GetShellWindowCount()); + ASSERT_EQ(1U, GetAppWindowCount()); } void PlatformAppUrlRedirectorBrowserTest::TestMismatchingNavigationInApp( @@ -261,7 +261,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestMismatchingNavigationInApp( ASSERT_TRUE(launcher_listener.WaitUntilSatisfied()); observer.Wait(); - ASSERT_EQ(1U, GetShellWindowCount()); + ASSERT_EQ(1U, GetAppWindowCount()); ASSERT_EQ(2, browser()->tab_strip_model()->count()); } @@ -285,7 +285,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNavigationInBrowser( ASSERT_TRUE(handler_listener.WaitUntilSatisfied()); - ASSERT_EQ(1U, GetShellWindowCount()); + ASSERT_EQ(1U, GetAppWindowCount()); } void PlatformAppUrlRedirectorBrowserTest::TestNegativeNavigationInBrowser( @@ -310,7 +310,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNegativeNavigationInBrowser( ui_test_utils::NavigateToURL(¶ms); ASSERT_EQ(success_title, title_watcher.WaitAndGetTitle()); - ASSERT_EQ(0U, GetShellWindowCount()); + ASSERT_EQ(0U, GetAppWindowCount()); } void PlatformAppUrlRedirectorBrowserTest::TestMismatchingNavigationInBrowser( diff --git a/chrome/browser/apps/app_window_browsertest.cc b/chrome/browser/apps/app_window_browsertest.cc index 251abaf..234ee3f 100644 --- a/chrome/browser/apps/app_window_browsertest.cc +++ b/chrome/browser/apps/app_window_browsertest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "apps/shell_window_geometry_cache.h" +#include "apps/app_window_geometry_cache.h" #include "chrome/browser/apps/app_browsertest_util.h" #include "chrome/browser/extensions/extension_test_message_listener.h" #include "chrome/browser/profiles/profile.h" @@ -13,13 +13,13 @@ #include "extensions/common/constants.h" #include "extensions/common/extension.h" -using apps::ShellWindowGeometryCache; +using apps::AppWindowGeometryCache; -// This helper class can be used to wait for changes in the shell window +// This helper class can be used to wait for changes in the app window // geometry cache registry for a specific window in a specific extension. -class GeometryCacheChangeHelper : ShellWindowGeometryCache::Observer { +class GeometryCacheChangeHelper : AppWindowGeometryCache::Observer { public: - GeometryCacheChangeHelper(ShellWindowGeometryCache* cache, + GeometryCacheChangeHelper(AppWindowGeometryCache* cache, const std::string& extension_id, const std::string& window_id, const gfx::Rect& bounds) @@ -32,7 +32,7 @@ class GeometryCacheChangeHelper : ShellWindowGeometryCache::Observer { cache_->AddObserver(this); } - // This method will block until the shell window geometry cache registry will + // This method will block until the app window geometry cache registry will // provide a bound for |window_id_| that is entirely different (as in x/y/w/h) // from the initial |bounds_|. void WaitForEntirelyChanged() { @@ -64,7 +64,7 @@ class GeometryCacheChangeHelper : ShellWindowGeometryCache::Observer { } private: - ShellWindowGeometryCache* cache_; + AppWindowGeometryCache* cache_; std::string extension_id_; std::string window_id_; gfx::Rect bounds_; @@ -189,16 +189,20 @@ IN_PROC_BROWSER_TEST_F(AppWindowAPITest, ASSERT_TRUE(geometry_listener.WaitUntilSatisfied()); GeometryCacheChangeHelper geo_change_helper_1( - ShellWindowGeometryCache::Get(browser()->profile()), extension->id(), + AppWindowGeometryCache::Get(browser()->profile()), + extension->id(), // The next line has information that has to stay in sync with the app. - "test-ra", gfx::Rect(200, 200, 200, 200)); + "test-ra", + gfx::Rect(200, 200, 200, 200)); GeometryCacheChangeHelper geo_change_helper_2( - ShellWindowGeometryCache::Get(browser()->profile()), extension->id(), + AppWindowGeometryCache::Get(browser()->profile()), + extension->id(), // The next line has information that has to stay in sync with the app. - "test-rb", gfx::Rect(200, 200, 200, 200)); + "test-rb", + gfx::Rect(200, 200, 200, 200)); - // These calls will block until the shell window geometry cache will change. + // These calls will block until the app window geometry cache will change. geo_change_helper_1.WaitForEntirelyChanged(); geo_change_helper_2.WaitForEntirelyChanged(); diff --git a/chrome/browser/apps/app_window_interactive_uitest.cc b/chrome/browser/apps/app_window_interactive_uitest.cc index 406ced9..5b79947 100644 --- a/chrome/browser/apps/app_window_interactive_uitest.cc +++ b/chrome/browser/apps/app_window_interactive_uitest.cc @@ -56,12 +56,12 @@ class AppWindowInteractiveTest : public extensions::PlatformAppBrowserTest { bool SimulateKeyPress(ui::KeyboardCode key) { return ui_test_utils::SendKeyPressToWindowSync( - GetFirstShellWindow()->GetNativeWindow(), - key, - false, - false, - false, - false); + GetFirstAppWindow()->GetNativeWindow(), + key, + false, + false, + false, + false); } // This method will wait until the application is able to ack a key event. @@ -88,14 +88,14 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenWindow) { // We start by making sure the window is actually focused. ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( - GetFirstShellWindow()->GetNativeWindow())); + GetFirstAppWindow()->GetNativeWindow())); // When receiving the reply, the application will try to go fullscreen using // the Window API but there is no synchronous way to know if that actually // succeeded. Also, failure will not be notified. A failure case will only be // known with a timeout. { - FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow()); + FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow()); launched_listener.Reply("window"); @@ -111,7 +111,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenWindow) { // Same idea as above but for leaving fullscreen. Fullscreen mode should be // left when ESC is received. { - FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow()); + FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow()); ASSERT_TRUE(SimulateKeyPress(ui::VKEY_ESCAPE)); @@ -132,7 +132,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenDOM) { // We start by making sure the window is actually focused. ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( - GetFirstShellWindow()->GetNativeWindow())); + GetFirstAppWindow()->GetNativeWindow())); launched_listener.Reply("dom"); @@ -145,7 +145,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenDOM) { // actually succeeded. Also, failure will not be notified. A failure case will // only be known with a timeout. { - FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow()); + FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow()); WaitUntilKeyFocus(); ASSERT_TRUE(SimulateKeyPress(ui::VKEY_A)); @@ -162,7 +162,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenDOM) { // Same idea as above but for leaving fullscreen. Fullscreen mode should be // left when ESC is received. { - FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow()); + FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow()); ASSERT_TRUE(SimulateKeyPress(ui::VKEY_ESCAPE)); @@ -184,14 +184,14 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, // We start by making sure the window is actually focused. ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( - GetFirstShellWindow()->GetNativeWindow())); + GetFirstAppWindow()->GetNativeWindow())); // When receiving the reply, the application will try to go fullscreen using // the Window API but there is no synchronous way to know if that actually // succeeded. Also, failure will not be notified. A failure case will only be // known with a timeout. { - FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow()); + FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow()); launched_listener.Reply("window"); @@ -216,7 +216,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, // However, by nature, we can not guarantee that and given that we do test // that nothing happens, we might end up with random-success when the feature // is broken. - EXPECT_TRUE(GetFirstShellWindow()->GetBaseWindow()->IsFullscreen()); + EXPECT_TRUE(GetFirstAppWindow()->GetBaseWindow()->IsFullscreen()); } IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, @@ -233,7 +233,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, // We start by making sure the window is actually focused. ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( - GetFirstShellWindow()->GetNativeWindow())); + GetFirstAppWindow()->GetNativeWindow())); launched_listener.Reply("dom"); @@ -246,7 +246,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, // actually succeeded. Also, failure will not be notified. A failure case will // only be known with a timeout. { - FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow()); + FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow()); WaitUntilKeyFocus(); ASSERT_TRUE(SimulateKeyPress(ui::VKEY_A)); @@ -272,7 +272,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, // However, by nature, we can not guarantee that and given that we do test // that nothing happens, we might end up with random-success when the feature // is broken. - EXPECT_TRUE(GetFirstShellWindow()->GetBaseWindow()->IsFullscreen()); + EXPECT_TRUE(GetFirstAppWindow()->GetBaseWindow()->IsFullscreen()); } // This test does not work on Linux Aura because ShowInactive() is not diff --git a/chrome/browser/apps/ephemeral_app_browsertest.cc b/chrome/browser/apps/ephemeral_app_browsertest.cc index 798a725..d18cbeb 100644 --- a/chrome/browser/apps/ephemeral_app_browsertest.cc +++ b/chrome/browser/apps/ephemeral_app_browsertest.cc @@ -78,10 +78,10 @@ class EphemeralAppBrowserTest : public PlatformAppBrowserTest { chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::Source<Profile>(browser()->profile())); - EXPECT_EQ(1U, GetShellWindowCountForApp(app_id)); - apps::ShellWindow* shell_window = GetFirstShellWindowForApp(app_id); - ASSERT_TRUE(shell_window); - CloseShellWindow(shell_window); + EXPECT_EQ(1U, GetAppWindowCountForApp(app_id)); + apps::AppWindow* app_window = GetFirstAppWindowForApp(app_id); + ASSERT_TRUE(app_window); + CloseAppWindow(app_window); event_page_destroyed_signal.Wait(); } diff --git a/chrome/browser/apps/event_page_browsertest.cc b/chrome/browser/apps/event_page_browsertest.cc index 2799aee..3cbcb77 100644 --- a/chrome/browser/apps/event_page_browsertest.cc +++ b/chrome/browser/apps/event_page_browsertest.cc @@ -28,10 +28,10 @@ class AppEventPageTest : public PlatformAppBrowserTest { content::NotificationService::AllSources()); // Close the app window. - EXPECT_EQ(1U, GetShellWindowCount()); - apps::ShellWindow* shell_window = GetFirstShellWindow(); - ASSERT_TRUE(shell_window); - CloseShellWindow(shell_window); + EXPECT_EQ(1U, GetAppWindowCount()); + apps::AppWindow* app_window = GetFirstAppWindow(); + ASSERT_TRUE(app_window); + CloseAppWindow(app_window); // Verify that the event page is destroyed. event_page_suspended.Wait(); diff --git a/chrome/browser/apps/web_view_browsertest.cc b/chrome/browser/apps/web_view_browsertest.cc index c96a591..bd154fe 100644 --- a/chrome/browser/apps/web_view_browsertest.cc +++ b/chrome/browser/apps/web_view_browsertest.cc @@ -520,7 +520,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { content::RunAllPendingInMessageLoop(); content::WebContents* embedder_web_contents = - GetFirstShellWindowWebContents(); + GetFirstAppWindowWebContents(); if (!embedder_web_contents) { LOG(ERROR) << "UNABLE TO FIND EMBEDDER WEB CONTENTS."; return; @@ -577,7 +577,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { ASSERT_TRUE(loaded_listener.WaitUntilSatisfied()); content::WebContents* embedder_web_contents = - GetFirstShellWindowWebContents(); + GetFirstAppWindowWebContents(); ASSERT_TRUE(embedder_web_contents); ExtensionTestMessageListener test_run_listener("PASSED", false); @@ -906,8 +906,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewOnExit) { LoadAndLaunchPlatformApp("web_view/shim"); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); - content::WebContents* embedder_web_contents = - GetFirstShellWindowWebContents(); + content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(embedder_web_contents); GURL::Replacements replace_host; @@ -998,8 +997,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, InterstitialTeardown) { SetBrowserClientForTesting(&new_client); // Now load the guest. - content::WebContents* embedder_web_contents = - GetFirstShellWindowWebContents(); + content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents(); ExtensionTestMessageListener second("GuestAddedToDom", false); EXPECT_TRUE(content::ExecuteScript( embedder_web_contents, @@ -1013,7 +1011,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, InterstitialTeardown) { WaitForInterstitial(guest_web_contents); // Now close the app while interstitial page being shown in guest. - apps::ShellWindow* window = GetFirstShellWindow(); + apps::AppWindow* window = GetFirstAppWindow(); window->GetBaseWindow()->Close(); } @@ -1490,8 +1488,7 @@ void WebViewTest::MediaAccessAPIAllowTestHelper(const std::string& test_name) { LoadAndLaunchPlatformApp("web_view/media_access/allow"); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); - content::WebContents* embedder_web_contents = - GetFirstShellWindowWebContents(); + content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(embedder_web_contents); MockWebContentsDelegate* mock = new MockWebContentsDelegate; embedder_web_contents->SetDelegate(mock); @@ -1581,12 +1578,12 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_TearDownTest) { const extensions::Extension* extension = LoadAndLaunchPlatformApp("web_view/teardown"); ASSERT_TRUE(first_loaded_listener.WaitUntilSatisfied()); - apps::ShellWindow* window = NULL; - if (!GetShellWindowCount()) - window = CreateShellWindow(extension); + apps::AppWindow* window = NULL; + if (!GetAppWindowCount()) + window = CreateAppWindow(extension); else - window = GetFirstShellWindow(); - CloseShellWindow(window); + window = GetFirstAppWindow(); + CloseAppWindow(window); // Load the app again. ExtensionTestMessageListener second_loaded_listener("guest-loaded", false); diff --git a/chrome/browser/apps/web_view_interactive_browsertest.cc b/chrome/browser/apps/web_view_interactive_browsertest.cc index 3e66b15..e95e3ae 100644 --- a/chrome/browser/apps/web_view_interactive_browsertest.cc +++ b/chrome/browser/apps/web_view_interactive_browsertest.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "apps/shell_window.h" -#include "apps/shell_window_registry.h" +#include "apps/app_window.h" +#include "apps/app_window_registry.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" @@ -27,7 +27,7 @@ #include "ui/base/test/ui_controls.h" #include "ui/events/keycodes/keyboard_codes.h" -using apps::ShellWindow; +using apps::AppWindow; class WebViewInteractiveTest : public extensions::PlatformAppBrowserTest { @@ -63,20 +63,19 @@ class WebViewInteractiveTest } gfx::NativeWindow GetPlatformAppWindow() { - const apps::ShellWindowRegistry::ShellWindowList& shell_windows = - apps::ShellWindowRegistry::Get( - browser()->profile())->shell_windows(); - return (*shell_windows.begin())->GetNativeWindow(); + const apps::AppWindowRegistry::AppWindowList& app_windows = + apps::AppWindowRegistry::Get(browser()->profile())->app_windows(); + return (*app_windows.begin())->GetNativeWindow(); } void SendKeyPressToPlatformApp(ui::KeyboardCode key) { - ASSERT_EQ(1U, GetShellWindowCount()); + ASSERT_EQ(1U, GetAppWindowCount()); ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( GetPlatformAppWindow(), key, false, false, false, false)); } void SendCopyKeyPressToPlatformApp() { - ASSERT_EQ(1U, GetShellWindowCount()); + ASSERT_EQ(1U, GetAppWindowCount()); #if defined(OS_MACOSX) // Send Cmd+C on MacOSX. ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( @@ -169,7 +168,7 @@ class WebViewInteractiveTest // Flush any pending events to make sure we start with a clean slate. content::RunAllPendingInMessageLoop(); - *embedder_web_contents = GetFirstShellWindowWebContents(); + *embedder_web_contents = GetFirstAppWindowWebContents(); scoped_ptr<ExtensionTestMessageListener> done_listener( new ExtensionTestMessageListener("TEST_PASSED", false)); @@ -336,7 +335,7 @@ class WebViewInteractiveTest SimulateRWHMouseClick(popup_rwh, blink::WebMouseEvent::ButtonLeft, 2, 2); content::RenderViewHost* embedder_rvh = - GetFirstShellWindowWebContents()->GetRenderViewHost(); + GetFirstAppWindowWebContents()->GetRenderViewHost(); gfx::Rect embedder_bounds = embedder_rvh->GetView()->GetViewBounds(); gfx::Vector2d diff = popup_bounds.origin() - embedder_bounds.origin(); LOG(INFO) << "DIFF: x = " << diff.x() << ", y = " << diff.y(); @@ -392,7 +391,7 @@ class WebViewInteractiveTest // MessageLoop) in it. // Now check if we got a drop and read the drop data. - embedder_web_contents_ = GetFirstShellWindowWebContents(); + embedder_web_contents_ = GetFirstAppWindowWebContents(); ExtensionTestMessageListener drop_listener("guest-got-drop", false); EXPECT_TRUE(content::ExecuteScript(embedder_web_contents_, "window.checkIfGuestGotDrop()")); @@ -688,7 +687,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DragDropWithinWebView) { ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(GetPlatformAppWindow())); gfx::Rect offset; - embedder_web_contents_ = GetFirstShellWindowWebContents(); + embedder_web_contents_ = GetFirstAppWindowWebContents(); embedder_web_contents_->GetView()->GetContainerBounds(&offset); corner_ = gfx::Point(offset.x(), offset.y()); @@ -737,8 +736,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Navigation_BackForwardKeys) { // Flush any pending events to make sure we start with a clean slate. content::RunAllPendingInMessageLoop(); - content::WebContents* embedder_web_contents = - GetFirstShellWindowWebContents(); + content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(embedder_web_contents); ExtensionTestMessageListener done_listener( |