Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / dbus / printer_service_provider_unittest.cc
blobae24e5cd0f3cd63539e0de22485033fea927118a
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/dbus/printer_service_provider.h"
7 #include "chromeos/dbus/services/service_provider_test_helper.h"
8 #include "dbus/message.h"
9 #include "third_party/cros_system_api/dbus/service_constants.h"
11 namespace chromeos {
13 const char kPrinterAdded[] = "PrinterAdded";
15 class MockPrinterServiceProvider : public PrinterServiceProvider {
16 public:
17 MOCK_METHOD2(ShowCloudPrintHelp,
18 void(const std::string& vendor, const std::string& product));
21 class PrinterServiceProviderTest : public testing::Test {
22 public:
23 void SetUp() override {
24 test_helper_.SetUp(kPrinterAdded, &service_provider_);
27 void TearDown() override { test_helper_.TearDown(); }
29 protected:
30 MockPrinterServiceProvider service_provider_;
31 ServiceProviderTestHelper test_helper_;
34 TEST_F(PrinterServiceProviderTest, ShowCloudPrintHelp) {
35 dbus::MethodCall method_call(kLibCrosServiceInterface, kPrinterAdded);
36 dbus::MessageWriter writer(&method_call);
37 writer.AppendString("123");
38 writer.AppendString("456");
40 EXPECT_CALL(service_provider_, ShowCloudPrintHelp("123", "456"))
41 .Times(1);
43 // Call the PrinterAdded method.
44 scoped_ptr<dbus::Response> response(test_helper_.CallMethod(&method_call));
46 // An empty response should be returned.
47 ASSERT_TRUE(response.get());
48 dbus::MessageReader reader(response.get());
49 ASSERT_FALSE(reader.HasMoreData());
52 } // namespace chromeos