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

Side by Side Diff: chrome/browser/extensions/api/usb/usb_apitest.cc

Issue 11117011: Keep browser process alive while there are platform apps with background pages running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And another test Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/usb/usb_api.h" 5 #include "chrome/browser/extensions/api/usb/usb_api.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/usb/usb_service.h" 8 #include "chrome/browser/usb/usb_service.h"
9 #include "chrome/browser/usb/usb_service_factory.h" 9 #include "chrome/browser/usb/usb_service_factory.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 protected: 76 protected:
77 scoped_refptr<MockUsbDevice> mock_device_; 77 scoped_refptr<MockUsbDevice> mock_device_;
78 }; 78 };
79 79
80 } // namespace 80 } // namespace
81 81
82 IN_PROC_BROWSER_TEST_F(UsbApiTest, DeviceHandling) { 82 IN_PROC_BROWSER_TEST_F(UsbApiTest, DeviceHandling) {
83 EXPECT_CALL(*mock_device_, Close(_)).Times(1); 83 EXPECT_CALL(*mock_device_, Close(_)).Times(1);
84 ASSERT_TRUE(RunExtensionTest("usb/device_handling")); 84 ASSERT_TRUE(RunPlatformAppTest("usb/device_handling"));
85 } 85 }
86 86
87 IN_PROC_BROWSER_TEST_F(UsbApiTest, TransferEvent) { 87 IN_PROC_BROWSER_TEST_F(UsbApiTest, TransferEvent) {
88 EXPECT_CALL(*mock_device_, 88 EXPECT_CALL(*mock_device_,
89 ControlTransfer(UsbDevice::OUTBOUND, UsbDevice::STANDARD, 89 ControlTransfer(UsbDevice::OUTBOUND, UsbDevice::STANDARD,
90 UsbDevice::DEVICE, 1, 2, 3, _, 1, _, _)) 90 UsbDevice::DEVICE, 1, 2, 3, _, 1, _, _))
91 .WillOnce(InvokeUsbTransferCallback<9>(USB_TRANSFER_COMPLETED)); 91 .WillOnce(InvokeUsbTransferCallback<9>(USB_TRANSFER_COMPLETED));
92 EXPECT_CALL(*mock_device_, 92 EXPECT_CALL(*mock_device_,
93 BulkTransfer(UsbDevice::OUTBOUND, 1, _, 1, _, _)) 93 BulkTransfer(UsbDevice::OUTBOUND, 1, _, 1, _, _))
94 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_COMPLETED)); 94 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_COMPLETED));
95 EXPECT_CALL(*mock_device_, 95 EXPECT_CALL(*mock_device_,
96 InterruptTransfer(UsbDevice::OUTBOUND, 2, _, 1, _, _)) 96 InterruptTransfer(UsbDevice::OUTBOUND, 2, _, 1, _, _))
97 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_COMPLETED)); 97 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_COMPLETED));
98 EXPECT_CALL(*mock_device_, 98 EXPECT_CALL(*mock_device_,
99 IsochronousTransfer(UsbDevice::OUTBOUND, 3, _, 1, 1, 1, _, _)) 99 IsochronousTransfer(UsbDevice::OUTBOUND, 3, _, 1, 1, 1, _, _))
100 .WillOnce(InvokeUsbTransferCallback<7>(USB_TRANSFER_COMPLETED)); 100 .WillOnce(InvokeUsbTransferCallback<7>(USB_TRANSFER_COMPLETED));
101 EXPECT_CALL(*mock_device_, Close(_)).Times(AnyNumber()); 101 EXPECT_CALL(*mock_device_, Close(_)).Times(AnyNumber());
102 ASSERT_TRUE(RunExtensionTest("usb/transfer_event")); 102 ASSERT_TRUE(RunPlatformAppTest("usb/transfer_event"));
103 } 103 }
104 104
105 IN_PROC_BROWSER_TEST_F(UsbApiTest, ZeroLengthTransfer) { 105 IN_PROC_BROWSER_TEST_F(UsbApiTest, ZeroLengthTransfer) {
106 EXPECT_CALL(*mock_device_, BulkTransfer(_, _, _, 0, _, _)) 106 EXPECT_CALL(*mock_device_, BulkTransfer(_, _, _, 0, _, _))
107 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_COMPLETED)); 107 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_COMPLETED));
108 EXPECT_CALL(*mock_device_, Close(_)).Times(AnyNumber()); 108 EXPECT_CALL(*mock_device_, Close(_)).Times(AnyNumber());
109 ASSERT_TRUE(RunExtensionTest("usb/zero_length_transfer")); 109 ASSERT_TRUE(RunPlatformAppTest("usb/zero_length_transfer"));
110 } 110 }
111 111
112 IN_PROC_BROWSER_TEST_F(UsbApiTest, TransferFailure) { 112 IN_PROC_BROWSER_TEST_F(UsbApiTest, TransferFailure) {
113 EXPECT_CALL(*mock_device_, BulkTransfer(_, _, _, _, _, _)) 113 EXPECT_CALL(*mock_device_, BulkTransfer(_, _, _, _, _, _))
114 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_COMPLETED)) 114 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_COMPLETED))
115 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_ERROR)) 115 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_ERROR))
116 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_TIMEOUT)); 116 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_TIMEOUT));
117 EXPECT_CALL(*mock_device_, Close(_)).Times(AnyNumber()); 117 EXPECT_CALL(*mock_device_, Close(_)).Times(AnyNumber());
118 ASSERT_TRUE(RunExtensionTest("usb/transfer_failure")); 118 ASSERT_TRUE(RunPlatformAppTest("usb/transfer_failure"));
119 } 119 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698