summaryrefslogtreecommitdiffstats
path: root/athena
diff options
context:
space:
mode:
authoroshima <oshima@chromium.org>2014-11-10 17:33:26 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-11 01:33:45 +0000
commit83fb6ac10916c03558210923e6520687f954a954 (patch)
tree6613f90ab7566524b9278ff45b0be203d81a5e31 /athena
parent7cc3e8201226dbb8903df0f429fc5656a15b36fd (diff)
downloadchromium_src-83fb6ac10916c03558210923e6520687f954a954.zip
chromium_src-83fb6ac10916c03558210923e6520687f954a954.tar.gz
chromium_src-83fb6ac10916c03558210923e6520687f954a954.tar.bz2
Enable debug accelerator in InputManger unit test
* InputManagerTest in accelerator_manager_unittests has been renamed to avoid name conflict. BUG=424109 Review URL: https://codereview.chromium.org/692333010 Cr-Commit-Position: refs/heads/master@{#303565}
Diffstat (limited to 'athena')
-rw-r--r--athena/input/accelerator_manager_unittest.cc6
-rw-r--r--athena/input/input_manager_unittest.cc23
-rw-r--r--athena/util/switches.cc4
-rw-r--r--athena/util/switches.h4
4 files changed, 28 insertions, 9 deletions
diff --git a/athena/input/accelerator_manager_unittest.cc b/athena/input/accelerator_manager_unittest.cc
index 2a103f6..3298b11 100644
--- a/athena/input/accelerator_manager_unittest.cc
+++ b/athena/input/accelerator_manager_unittest.cc
@@ -48,9 +48,9 @@ class TestHandler : public AcceleratorHandler {
} // namespace
-typedef test::AthenaTestBase InputManagerTest;
+typedef test::AthenaTestBase AcceleratorManagerTest;
-TEST_F(InputManagerTest, Basic) {
+TEST_F(AcceleratorManagerTest, Basic) {
enum TestCommandId {
COMMAND_A,
COMMAND_B,
@@ -119,7 +119,7 @@ TEST_F(InputManagerTest, Basic) {
EXPECT_EQ(COMMAND_E, test_handler.GetFiredCommandIdAndReset());
}
-TEST_F(InputManagerTest, CloseActivity) {
+TEST_F(AcceleratorManagerTest, CloseActivity) {
ActivityFactory* factory = ActivityFactory::Get();
Activity* activity1 =
factory->CreateWebActivity(NULL, base::string16(), GURL());
diff --git a/athena/input/input_manager_unittest.cc b/athena/input/input_manager_unittest.cc
index 242724a..5b0305b 100644
--- a/athena/input/input_manager_unittest.cc
+++ b/athena/input/input_manager_unittest.cc
@@ -6,6 +6,8 @@
#include "athena/input/public/accelerator_manager.h"
#include "athena/test/base/athena_test_base.h"
+#include "athena/util/switches.h"
+#include "base/command_line.h"
#include "base/run_loop.h"
#include "ui/events/test/event_generator.h"
@@ -46,6 +48,21 @@ class TestPowerButtonObserver : public PowerButtonObserver {
DISALLOW_COPY_AND_ASSIGN(TestPowerButtonObserver);
};
+class InputManagerTest : public test::AthenaTestBase {
+ public:
+ InputManagerTest() {}
+ ~InputManagerTest() override {}
+
+ void SetUp() override {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ command_line->AppendSwitch(switches::kEnableDebugAccelerators);
+ test::AthenaTestBase::SetUp();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(InputManagerTest);
+};
+
} // namespace
namespace test {
@@ -70,11 +87,7 @@ class ScopedPowerButtonTimeoutShortener {
} // namespace test
-typedef test::AthenaTestBase InputManagerTest;
-
-// This fails on bots. crbug.com/424109.
-// Investigate once crbug.com/424093 is fixed.
-TEST_F(InputManagerTest, DISABLED_PowerButton) {
+TEST_F(InputManagerTest, PowerButton) {
test::ScopedPowerButtonTimeoutShortener shortener;
TestPowerButtonObserver observer;
diff --git a/athena/util/switches.cc b/athena/util/switches.cc
index 1b76f1f..b7adced 100644
--- a/athena/util/switches.cc
+++ b/athena/util/switches.cc
@@ -9,10 +9,12 @@
namespace athena {
namespace switches {
+const char kEnableDebugAccelerators[] = "debug-accelerators";
+
bool IsDebugAcceleratorsEnabled() {
#if NDEBUG
return base::CommandLine::ForCurrentProcess()->HasSwitch(
- "debug-accelerators");
+ kEnableDebugAccelerators);
#else
return true;
#endif
diff --git a/athena/util/switches.h b/athena/util/switches.h
index b598e8a..d884e2c 100644
--- a/athena/util/switches.h
+++ b/athena/util/switches.h
@@ -5,9 +5,13 @@
#ifndef ATHENA_UTIL_SWITCHES_H_
#define ATHENA_UTIL_SWITCHES_H_
+#include "athena/athena_export.h"
+
namespace athena {
namespace switches {
+ATHENA_EXPORT extern const char kEnableDebugAccelerators[];
+
bool IsDebugAcceleratorsEnabled();
} // namespace switches