diff options
author | Albert J. Wong <ajwong@chromium.org> | 2014-08-27 17:25:24 -0700 |
---|---|---|
committer | Albert J. Wong <ajwong@chromium.org> | 2014-08-28 00:26:53 +0000 |
commit | 80b00e579d615035a2693ed5a16fe4576671841c (patch) | |
tree | 0dd3b8a63b7d8281491a16a4030df054783785b1 /device | |
parent | 500986e5074fea2f069a0e16fd9f0cf03e6302dd (diff) | |
download | chromium_src-80b00e579d615035a2693ed5a16fe4576671841c.zip chromium_src-80b00e579d615035a2693ed5a16fe4576671841c.tar.gz chromium_src-80b00e579d615035a2693ed5a16fe4576671841c.tar.bz2 |
Revert of Adding Select Action Bar Unit test case for input (patchset #3 of https://codereview.chromium.org/506423003/)
Reason for revert:
Failed compile on Android builders.
Original issue's description:
> [Android] Add unit tests for SelectActionBar appearance
>
> The SelectActionBar currently lacks test coverage. Add several test
> cases covering the appearance of the bar when interacting with an input
> field.
>
> Committed: https://chromium.googlesource.com/chromium/src/+/0bc56569817a24acea46748c599d77b59157d84d
BR=jdduke@chromium.org,aurimas@chromium.org,ajith.v@samsung.com
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/514493004
Cr-Commit-Position: refs/heads/master@{#292276}
Diffstat (limited to 'device')
-rw-r--r-- | device/hid/hid_connection_unittest.cc | 3 | ||||
-rw-r--r-- | device/hid/hid_service.cc | 51 | ||||
-rw-r--r-- | device/hid/hid_service.h | 2 | ||||
-rw-r--r-- | device/hid/hid_service_unittest.cc | 4 |
4 files changed, 10 insertions, 50 deletions
diff --git a/device/hid/hid_connection_unittest.cc b/device/hid/hid_connection_unittest.cc index ecc51b7c..e5f215f 100644 --- a/device/hid/hid_connection_unittest.cc +++ b/device/hid/hid_connection_unittest.cc @@ -73,8 +73,7 @@ class HidConnectionTest : public testing::Test { if (!UsbTestGadget::IsTestEnabled()) return; message_loop_.reset(new base::MessageLoopForIO()); - service_.reset(HidService::GetInstance( - message_loop_->message_loop_proxy())); + service_.reset(HidService::Create(message_loop_->message_loop_proxy())); ASSERT_TRUE(service_); test_gadget_ = UsbTestGadget::Claim(); diff --git a/device/hid/hid_service.cc b/device/hid/hid_service.cc index 8b7cc0a..0e2f0d4 100644 --- a/device/hid/hid_service.cc +++ b/device/hid/hid_service.cc @@ -7,7 +7,6 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/memory/scoped_vector.h" -#include "base/message_loop/message_loop.h" #include "base/stl_util.h" #include "base/threading/thread_restrictions.h" @@ -21,55 +20,17 @@ namespace device { -namespace { - -// TODO(rockot/reillyg): This is pretty awful all around. There is a combination -// of constraints here: HidService doesn't know about //content, it must be able -// to talk to the PermissionBrokerClient on ChromeOS (UI thread), and it's -// expected to live and die on the FILE thread (for now). Solution? Make it a -// singleton whose instance getter takes a UI message loop proxy, and let the -// lifetime of the HidService be managed by a MessageLoop::DestructionObserver. -// -// The right long-term solution is probably a mojo service. A tolerable -// medium-term solution is up for debate. -class HidServiceDestroyer : public base::MessageLoop::DestructionObserver { - public: - explicit HidServiceDestroyer(HidService* hid_service) - : hid_service_(hid_service) {} - virtual ~HidServiceDestroyer() {} - - private: - // base::MessageLoop::DestructionObserver implementation. - virtual void WillDestroyCurrentMessageLoop() OVERRIDE { - base::MessageLoop::current()->RemoveDestructionObserver(this); - delete hid_service_; - delete this; - hid_service_ = NULL; - } - - HidService* hid_service_; -}; - -HidService* g_service = NULL; - -} // namespace - -HidService* HidService::GetInstance( +HidService* HidService::Create( scoped_refptr<base::MessageLoopProxy> ui_message_loop) { - if (g_service == NULL) { #if defined(OS_LINUX) && defined(USE_UDEV) - g_service = new HidServiceLinux(ui_message_loop); + return new HidServiceLinux(ui_message_loop); #elif defined(OS_MACOSX) - g_service = new HidServiceMac(); + return new HidServiceMac(); #elif defined(OS_WIN) - g_service = new HidServiceWin(); + return new HidServiceWin(); +#else + return NULL; #endif - if (g_service != NULL) { - HidServiceDestroyer* destroyer = new HidServiceDestroyer(g_service); - base::MessageLoop::current()->AddDestructionObserver(destroyer); - } - } - return g_service; } HidService::~HidService() { diff --git a/device/hid/hid_service.h b/device/hid/hid_service.h index 6a39cdd..c8e4e41 100644 --- a/device/hid/hid_service.h +++ b/device/hid/hid_service.h @@ -20,7 +20,7 @@ class HidConnection; class HidService { public: - static HidService* GetInstance( + static HidService* Create( scoped_refptr<base::MessageLoopProxy> ui_message_loop); virtual ~HidService(); diff --git a/device/hid/hid_service_unittest.cc b/device/hid/hid_service_unittest.cc index 2291300..a807579 100644 --- a/device/hid/hid_service_unittest.cc +++ b/device/hid/hid_service_unittest.cc @@ -13,8 +13,8 @@ namespace device { TEST(HidServiceTest, Create) { base::MessageLoopForIO message_loop; - HidService* service = HidService::GetInstance( - message_loop.message_loop_proxy()); + scoped_ptr<HidService> service( + HidService::Create(message_loop.message_loop_proxy())); ASSERT_TRUE(service); std::vector<HidDeviceInfo> devices; |