Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / ui / views / controls / button / custom_button_unittest.cc
index ace0df7..a5d97c9 100644 (file)
@@ -5,23 +5,20 @@
 #include "ui/views/controls/button/custom_button.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
+#include "ui/aura/test/test_cursor_client.h"
+#include "ui/aura/window.h"
+#include "ui/aura/window_event_dispatcher.h"
 #include "ui/base/layout.h"
 #include "ui/gfx/screen.h"
 #include "ui/views/controls/button/checkbox.h"
 #include "ui/views/controls/button/image_button.h"
+#include "ui/views/controls/button/label_button.h"
 #include "ui/views/controls/button/menu_button.h"
 #include "ui/views/controls/button/radio_button.h"
-#include "ui/views/controls/button/text_button.h"
 #include "ui/views/controls/link.h"
 #include "ui/views/controls/textfield/textfield.h"
 #include "ui/views/test/views_test_base.h"
 
-#if defined(USE_AURA)
-#include "ui/aura/root_window.h"
-#include "ui/aura/test/test_cursor_client.h"
-#include "ui/aura/window.h"
-#endif
-
 namespace views {
 
 namespace {
@@ -38,15 +35,12 @@ class TestCustomButton : public CustomButton {
   DISALLOW_COPY_AND_ASSIGN(TestCustomButton);
 };
 
-#if defined(USE_AURA)
 void PerformGesture(CustomButton* button, ui::EventType event_type) {
-  ui::GestureEventDetails gesture_details(event_type, 0, 0);
+  ui::GestureEventDetails gesture_details(event_type);
   base::TimeDelta time_stamp = base::TimeDelta::FromMicroseconds(0);
-  ui::GestureEvent gesture_event(gesture_details.type(), 0, 0, 0, time_stamp,
-                                 gesture_details, 1);
+  ui::GestureEvent gesture_event(0, 0, 0, time_stamp, gesture_details);
   button->OnGestureEvent(&gesture_event);
 }
-#endif  // USE_AURA
 
 }  // namespace
 
@@ -63,10 +57,8 @@ TEST_F(CustomButtonTest, HoverStateOnVisibilityChange) {
   widget->Init(params);
   widget->Show();
 
-#if defined(USE_AURA)
   aura::test::TestCursorClient cursor_client(
       widget->GetNativeView()->GetRootWindow());
-#endif
 
   // Position the widget in a way so that it is under the cursor.
   gfx::Point cursor = gfx::Screen::GetScreenFor(
@@ -101,7 +93,6 @@ TEST_F(CustomButtonTest, HoverStateOnVisibilityChange) {
   button->SetVisible(true);
   EXPECT_EQ(CustomButton::STATE_HOVERED, button->state());
 
-#if defined(USE_AURA)
   // In Aura views, no new hover effects are invoked if mouse events
   // are disabled.
   cursor_client.DisableMouseEvents();
@@ -117,10 +108,8 @@ TEST_F(CustomButtonTest, HoverStateOnVisibilityChange) {
 
   button->SetVisible(true);
   EXPECT_EQ(CustomButton::STATE_NORMAL, button->state());
-#endif
 }
 
-#if defined(USE_AURA)
 // Tests that gesture events correctly change the button state.
 TEST_F(CustomButtonTest, GestureEventsSetState) {
   // Create a widget so that the CustomButton can query the hover state
@@ -150,15 +139,12 @@ TEST_F(CustomButtonTest, GestureEventsSetState) {
   EXPECT_EQ(CustomButton::STATE_NORMAL, button->state());
 }
 
-#endif  // USE_AURA
-
-// Make sure all subclasses of CustomButton are correctly recognized
-// as CustomButton.
+// Ensure subclasses of CustomButton are correctly recognized as CustomButton.
 TEST_F(CustomButtonTest, AsCustomButton) {
   base::string16 text;
 
-  TextButton text_button(NULL, text);
-  EXPECT_TRUE(CustomButton::AsCustomButton(&text_button));
+  LabelButton label_button(NULL, text);
+  EXPECT_TRUE(CustomButton::AsCustomButton(&label_button));
 
   ImageButton image_button(NULL);
   EXPECT_TRUE(CustomButton::AsCustomButton(&image_button));