Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1800)

Unified Diff: ash/wm/workspace/workspace_layout_manager_unittest.cc

Issue 100903002: Ignore fullscreen windows which are behind other windows for fullscreen mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.cc ('k') | ash/wm/workspace_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_layout_manager_unittest.cc
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc
index 4302f1dc44f9bdb6093f59bc2a286b2d743ff77a..d12fb15bb79caa5e42906389e50c8085a5416b59 100644
--- a/ash/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -11,6 +11,7 @@
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
+#include "ash/shell_observer.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
@@ -47,6 +48,38 @@ class MaximizeDelegateView : public views::WidgetDelegateView {
DISALLOW_COPY_AND_ASSIGN(MaximizeDelegateView);
};
+class TestShellObserver : public ShellObserver {
+ public:
+ TestShellObserver() : call_count_(0),
+ is_fullscreen_(false) {
+ Shell::GetInstance()->AddShellObserver(this);
+ }
+
+ virtual ~TestShellObserver() {
+ Shell::GetInstance()->RemoveShellObserver(this);
+ }
+
+ virtual void OnFullscreenStateChanged(bool is_fullscreen,
+ aura::Window* root_window) OVERRIDE {
+ call_count_++;
+ is_fullscreen_ = is_fullscreen;
+ }
+
+ int call_count() const {
+ return call_count_;
+ }
+
+ bool is_fullscreen() const {
+ return is_fullscreen_;
+ }
+
+ private:
+ int call_count_;
+ bool is_fullscreen_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestShellObserver);
+};
+
} // namespace
typedef test::AshTestBase WorkspaceLayoutManagerTest;
@@ -407,4 +440,42 @@ TEST_F(WorkspaceLayoutManagerTest, SizeToWorkArea) {
window->bounds().ToString());
}
+TEST_F(WorkspaceLayoutManagerTest, NotifyFullscreenChanges) {
+ TestShellObserver observer;
+ scoped_ptr<aura::Window> window1(
+ CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40)));
+ scoped_ptr<aura::Window> window2(
+ CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40)));
+ wm::WindowState* window_state1 = wm::GetWindowState(window1.get());
+ wm::WindowState* window_state2 = wm::GetWindowState(window2.get());
+ window_state2->Activate();
+
+ window_state2->ToggleFullscreen();
+ EXPECT_EQ(1, observer.call_count());
+ EXPECT_TRUE(observer.is_fullscreen());
+
+ // When window1 moves to the front the fullscreen state should change.
+ window_state1->Activate();
+ EXPECT_EQ(2, observer.call_count());
+ EXPECT_FALSE(observer.is_fullscreen());
+
+ // It should change back if window2 becomes active again.
+ window_state2->Activate();
+ EXPECT_EQ(3, observer.call_count());
+ EXPECT_TRUE(observer.is_fullscreen());
+
+ window_state2->ToggleFullscreen();
+ EXPECT_EQ(4, observer.call_count());
+ EXPECT_FALSE(observer.is_fullscreen());
+
+ window_state2->ToggleFullscreen();
+ EXPECT_EQ(5, observer.call_count());
+ EXPECT_TRUE(observer.is_fullscreen());
+
+ // Closing the window should change the fullscreen state.
+ window2.reset();
+ EXPECT_EQ(6, observer.call_count());
+ EXPECT_FALSE(observer.is_fullscreen());
+}
+
} // namespace ash
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.cc ('k') | ash/wm/workspace_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698