| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <gdk/gdkkeysyms.h> | 5 #include <gdk/gdkkeysyms.h> |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/ui/gtk/accelerators_gtk.h" | 9 #include "chrome/browser/ui/gtk/accelerators_gtk.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "ui/base/models/accelerator_gtk.h" | 11 #include "ui/base/accelerators/accelerator_gtk.h" |
| 12 | 12 |
| 13 TEST(AcceleratorsGtkTest, GetAccelerator) { | 13 TEST(AcceleratorsGtkTest, GetAccelerator) { |
| 14 AcceleratorsGtk* keymap = AcceleratorsGtk::GetInstance(); | 14 AcceleratorsGtk* keymap = AcceleratorsGtk::GetInstance(); |
| 15 const ui::AcceleratorGtk* accelerator = | 15 const ui::AcceleratorGtk* accelerator = |
| 16 keymap->GetPrimaryAcceleratorForCommand(IDC_COPY); | 16 keymap->GetPrimaryAcceleratorForCommand(IDC_COPY); |
| 17 ASSERT_TRUE(accelerator); | 17 ASSERT_TRUE(accelerator); |
| 18 EXPECT_EQ(static_cast<guint>(GDK_c), accelerator->GetGdkKeyCode()); | 18 EXPECT_EQ(static_cast<guint>(GDK_c), accelerator->GetGdkKeyCode()); |
| 19 EXPECT_EQ(GDK_CONTROL_MASK, accelerator->modifiers()); | 19 EXPECT_EQ(GDK_CONTROL_MASK, accelerator->modifiers()); |
| 20 } | 20 } |
| 21 | 21 |
| 22 TEST(AcceleratorsGtkTest, GetNullAccelerator) { | 22 TEST(AcceleratorsGtkTest, GetNullAccelerator) { |
| 23 AcceleratorsGtk* keymap = AcceleratorsGtk::GetInstance(); | 23 AcceleratorsGtk* keymap = AcceleratorsGtk::GetInstance(); |
| 24 const ui::AcceleratorGtk* accelerator = | 24 const ui::AcceleratorGtk* accelerator = |
| 25 keymap->GetPrimaryAcceleratorForCommand(IDC_MinimumLabelValue - 1); | 25 keymap->GetPrimaryAcceleratorForCommand(IDC_MinimumLabelValue - 1); |
| 26 EXPECT_FALSE(accelerator); | 26 EXPECT_FALSE(accelerator); |
| 27 } | 27 } |
| OLD | NEW |