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

Unified Diff: ash/root_window_controller_unittest.cc

Issue 97013002: [Input View] Makes the input view window support window.resizeTo() and w3c visibility API its web c… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 | « no previous file | ash/shell/keyboard_controller_proxy_stub.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/root_window_controller_unittest.cc
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index 2ff7362629a1b4eb392ad8e688ed92897f77cb69..237a513a451ffbfa0d96fd141bfade232ed2234c 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -21,10 +21,12 @@
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/event_generator.h"
+#include "ui/aura/test/test_event_handler.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tracker.h"
+#include "ui/keyboard/keyboard_controller_proxy.h"
#include "ui/keyboard/keyboard_switches.h"
#include "ui/views/controls/menu/menu_controller.h"
#include "ui/views/widget/widget.h"
@@ -85,36 +87,6 @@ class DeleteOnBlurDelegate : public aura::test::TestWindowDelegate,
DISALLOW_COPY_AND_ASSIGN(DeleteOnBlurDelegate);
};
-class ClickTestWindow : public views::WidgetDelegateView {
- public:
- ClickTestWindow() : mouse_presses_(0) {}
- virtual ~ClickTestWindow() {}
-
- // Overridden from views::WidgetDelegate:
- virtual views::View* GetContentsView() OVERRIDE {
- return this;
- }
-
- aura::Window* CreateTestWindowWithParent(aura::Window* parent) {
- DCHECK(parent);
- views::Widget* widget = Widget::CreateWindowWithParent(this, parent);
- return widget->GetNativeView();
- }
-
- // Overridden from views::View:
- virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE {
- mouse_presses_++;
- return false;
- }
-
- int mouse_presses() const { return mouse_presses_; }
-
- private:
- int mouse_presses_;
-
- DISALLOW_COPY_AND_ASSIGN(ClickTestWindow);
-};
-
} // namespace
namespace test {
@@ -646,16 +618,19 @@ TEST_F(VirtualKeyboardRootWindowControllerTest,
ASSERT_TRUE(keyboard_container);
keyboard_container->Show();
- ClickTestWindow* main_delegate = new ClickTestWindow();
- scoped_ptr<aura::Window> keyboard_window(
- main_delegate->CreateTestWindowWithParent(keyboard_container));
- keyboard_container->layout_manager()->OnWindowResized();
+ aura::Window* keyboard_window = Shell::GetInstance()->keyboard_controller()->
+ proxy()->GetKeyboardWindow();
+ keyboard_container->AddChild(keyboard_window);
+ keyboard_window->SetBounds(gfx::Rect());
keyboard_window->Show();
- aura::test::EventGenerator event_generator(root_window,
- keyboard_window.get());
+
+ aura::test::TestEventHandler* handler = new aura::test::TestEventHandler;
+ root_window->SetEventFilter(handler);
+
+ aura::test::EventGenerator event_generator(root_window, keyboard_window);
event_generator.ClickLeftButton();
int expected_mouse_presses = 1;
- EXPECT_EQ(expected_mouse_presses, main_delegate->mouse_presses());
+ EXPECT_EQ(expected_mouse_presses, handler->num_mouse_events() / 2);
for (int block_reason = FIRST_BLOCK_REASON;
block_reason < NUMBER_OF_BLOCK_REASONS;
@@ -663,7 +638,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest,
BlockUserSession(static_cast<UserSessionBlockReason>(block_reason));
event_generator.ClickLeftButton();
expected_mouse_presses++;
- EXPECT_EQ(expected_mouse_presses, main_delegate->mouse_presses());
+ EXPECT_EQ(expected_mouse_presses, handler->num_mouse_events() / 2);
UnblockUserSession();
}
}
« no previous file with comments | « no previous file | ash/shell/keyboard_controller_proxy_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698