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

Unified Diff: chromeos/printing/fake_printer_detector.h

Issue 2344393002: Add a PrinterDiscoverer fake object. (Closed)
Patch Set: comments addressed Created 4 years, 3 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
Index: chromeos/printing/fake_printer_detector.h
diff --git a/chromeos/printing/fake_printer_detector.h b/chromeos/printing/fake_printer_detector.h
new file mode 100644
index 0000000000000000000000000000000000000000..ef6d0c02f8f9b78ad3ac0601e3143b68b34e2bb2
--- /dev/null
+++ b/chromeos/printing/fake_printer_detector.h
@@ -0,0 +1,41 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_PRINTING_FAKE_PRINTER_DETECTOR_H_
+#define CHROMEOS_PRINTING_FAKE_PRINTER_DETECTOR_H_
+
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "chromeos/printing/printer_configuration.h"
+#include "chromeos/printing/printer_detector.h"
+
+namespace chromeos {
+
+class FakePrinterDetector : public PrinterDetector {
+ public:
+ FakePrinterDetector();
+ ~FakePrinterDetector();
+
+ bool StartDiscovery() override;
+ bool StopDiscovery() override;
+ void AddObserver(PrinterDetector::Observer* observer) override;
+ void RemoveObserver(PrinterDetector::Observer* observer) override;
+
+ private:
+ void EmitPrinters(size_t start, size_t end);
+
+ std::vector<chromeos::Printer> printers_;
+ bool discovery_running_;
+ std::vector<PrinterDetector::Observer*> observers_;
+
+ base::WeakPtrFactory<FakePrinterDetector> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakePrinterDetector);
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_PRINTING_FAKE_PRINTER_DETECTOR_H_

Powered by Google App Engine
This is Rietveld 408576698