#include "chrome/test/base/testing_profile.h"
#include "content/public/test/render_view_test.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
-#include "ui/aura/root_window.h"
#include "ui/aura/test/test_windows.h"
+#include "ui/aura/window_event_dispatcher.h"
#include "ui/gfx/screen.h"
+#include "ui/wm/public/activation_client.h"
typedef ash::test::AshTestBase WindowSizerAshTest;
{
aura::Window* first_root =
ash::Shell::GetAllRootWindows()[0];
- ash::internal::ScopedTargetRootWindow tmp(
- first_root);
+ ash::ScopedTargetRootWindow tmp(first_root);
gfx::Rect bounds;
ui::WindowShowState show_state;
WindowSizer::GetBrowserWindowBoundsAndShowState(
{
aura::Window* second_root =
ash::Shell::GetAllRootWindows()[1];
- ash::internal::ScopedTargetRootWindow tmp(
- second_root);
+ ash::ScopedTargetRootWindow tmp(second_root);
gfx::Rect bounds;
ui::WindowShowState show_state;
WindowSizer::GetBrowserWindowBoundsAndShowState(
EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds));
}
}
+
+TEST_F(WindowSizerAshTest, TrustedPopupBehavior) {
+ scoped_ptr<TestingProfile> profile(new TestingProfile());
+ Browser::CreateParams trusted_popup_create_params(
+ Browser::TYPE_POPUP, profile.get(), chrome::HOST_DESKTOP_TYPE_ASH);
+ trusted_popup_create_params.trusted_source = true;
+
+ scoped_ptr<TestBrowserWindowAura> trusted_popup(CreateTestBrowserWindow(
+ CreateTestWindowInShellWithId(1),
+ gfx::Rect(16, 32, 640, 320),
+ trusted_popup_create_params));
+ // Trusted popup windows should follow the saved show state and ignore the
+ // last show state.
+ EXPECT_EQ(ui::SHOW_STATE_DEFAULT,
+ GetWindowShowState(ui::SHOW_STATE_DEFAULT,
+ ui::SHOW_STATE_NORMAL,
+ BOTH,
+ trusted_popup->browser(),
+ p1600x1200));
+}