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

Side by Side Diff: ui/keyboard/keyboard_controller_unittest.cc

Issue 944763002: Make Page Visibility API work when the browser window is visible or not Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove the VisibilityNotify event handler Created 5 years, 10 months 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 unified diff | Download patch
OLDNEW
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 "ui/keyboard/keyboard_controller.h" 5 #include "ui/keyboard/keyboard_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 }; 141 };
142 142
143 class KeyboardContainerObserver : public aura::WindowObserver { 143 class KeyboardContainerObserver : public aura::WindowObserver {
144 public: 144 public:
145 explicit KeyboardContainerObserver(aura::Window* window) : window_(window) { 145 explicit KeyboardContainerObserver(aura::Window* window) : window_(window) {
146 window_->AddObserver(this); 146 window_->AddObserver(this);
147 } 147 }
148 ~KeyboardContainerObserver() override { window_->RemoveObserver(this); } 148 ~KeyboardContainerObserver() override { window_->RemoveObserver(this); }
149 149
150 private: 150 private:
151 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override { 151 void OnWindowVisibilityChanged(aura::Window* window, bool visible,
152 bool content_visible) override {
152 if (!visible) 153 if (!visible)
153 base::MessageLoop::current()->Quit(); 154 base::MessageLoop::current()->Quit();
154 } 155 }
155 156
156 aura::Window* window_; 157 aura::Window* window_;
157 158
158 DISALLOW_COPY_AND_ASSIGN(KeyboardContainerObserver); 159 DISALLOW_COPY_AND_ASSIGN(KeyboardContainerObserver);
159 }; 160 };
160 161
161 } // namespace 162 } // namespace
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 // Before hide animation finishes, show keyboard again. 594 // Before hide animation finishes, show keyboard again.
594 ShowKeyboard(); 595 ShowKeyboard();
595 RunAnimationForLayer(layer); 596 RunAnimationForLayer(layer);
596 EXPECT_TRUE(keyboard_container()->IsVisible()); 597 EXPECT_TRUE(keyboard_container()->IsVisible());
597 EXPECT_TRUE(keyboard_window()->IsVisible()); 598 EXPECT_TRUE(keyboard_window()->IsVisible());
598 EXPECT_EQ(1.0, layer->opacity()); 599 EXPECT_EQ(1.0, layer->opacity());
599 EXPECT_EQ(gfx::Transform(), layer->transform()); 600 EXPECT_EQ(gfx::Transform(), layer->transform());
600 } 601 }
601 602
602 } // namespace keyboard 603 } // namespace keyboard
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698