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

Unified Diff: device/devices_app/usb/device_manager_impl_unittest.cc

Issue 1226163009: Convert usages of mojo::ErrorHandler in //device to callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comment. Created 5 years, 5 months 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 | « device/devices_app/usb/device_manager_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/devices_app/usb/device_manager_impl_unittest.cc
diff --git a/device/devices_app/usb/device_manager_impl_unittest.cc b/device/devices_app/usb/device_manager_impl_unittest.cc
index 0855b26a30fa628538b0e18becf57e8362001401..4b0a9bf0267b56e8cca1a551d87ec1ba5eb4bad3 100644
--- a/device/devices_app/usb/device_manager_impl_unittest.cc
+++ b/device/devices_app/usb/device_manager_impl_unittest.cc
@@ -19,7 +19,6 @@
#include "device/usb/mock_usb_device_handle.h"
#include "device/usb/mock_usb_service.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
using ::testing::Invoke;
@@ -80,23 +79,6 @@ class USBDeviceManagerImplTest : public testing::Test {
scoped_ptr<TestDeviceClient> device_client_;
};
-// This is used this to watch a MessagePipe and run a given callback when the
-// pipe is closed.
-class PipeWatcher : public mojo::ErrorHandler {
- public:
- PipeWatcher(const base::Closure& error_callback)
- : error_callback_(error_callback) {}
- ~PipeWatcher() override {}
-
- private:
- // mojo::ErrorHandler:
- void OnConnectionError() override { error_callback_.Run(); }
-
- const base::Closure error_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(PipeWatcher);
-};
-
class MockOpenCallback {
public:
explicit MockOpenCallback(UsbDevice* device) : device_(device) {}
@@ -222,8 +204,7 @@ TEST_F(USBDeviceManagerImplTest, OpenDevice) {
{
base::RunLoop loop;
- scoped_ptr<PipeWatcher> watcher(new PipeWatcher(loop.QuitClosure()));
- bad_device.set_error_handler(watcher.get());
+ bad_device.set_connection_error_handler(loop.QuitClosure());
bad_device->GetDeviceInfo(base::Bind(&FailOnGetDeviceInfoResponse));
loop.Run();
}
« no previous file with comments | « device/devices_app/usb/device_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698