1 // Copyright 2015 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 "device/usb/usb_device_filter.h"
6 #include "extensions/common/api/printer_provider/usb_printer_manifest_data.h"
7 #include "extensions/common/manifest_test.h"
8 #include "extensions/common/value_builder.h"
10 namespace extensions
{
12 class UsbPrinterManifestTest
: public ManifestTest
{
14 UsbPrinterManifestTest() {}
15 ~UsbPrinterManifestTest() override
{}
18 TEST_F(UsbPrinterManifestTest
, Filters
) {
19 scoped_refptr
<Extension
> extension
=
20 LoadAndExpectSuccess("usb_printers_filters.json");
21 const UsbPrinterManifestData
* manifest_data
=
22 UsbPrinterManifestData::Get(extension
.get());
23 ASSERT_TRUE(manifest_data
);
24 EXPECT_EQ(2u, manifest_data
->filters().size());
25 EXPECT_TRUE(DictionaryBuilder()
29 ->Equals(manifest_data
->filters()[0].ToValue().get()));
30 EXPECT_TRUE(DictionaryBuilder()
32 .Set("interfaceClass", 2)
33 .Set("interfaceSubclass", 3)
34 .Set("interfaceProtocol", 4)
36 ->Equals(manifest_data
->filters()[1].ToValue().get()));
39 TEST_F(UsbPrinterManifestTest
, InvalidFilter
) {
41 "usb_printers_invalid_filter.json",
42 "Only one of productId or interfaceClass may be specified.");
45 } // namespace extensions