| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/usb/web_usb_detector.h" | 10 #include "chrome/browser/usb/web_usb_detector.h" |
| 11 #include "device/base/mock_device_client.h" | 11 #include "device/base/mock_device_client.h" |
| 12 #include "device/usb/mock_usb_device.h" | 12 #include "device/usb/mock_usb_device.h" |
| 13 #include "device/usb/mock_usb_service.h" | 13 #include "device/usb/mock_usb_service.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/message_center/message_center.h" | 15 #include "ui/message_center/message_center.h" |
| 16 #include "ui/message_center/notification.h" | 16 #include "ui/message_center/notification.h" |
| 17 #include "ui/message_center/notification_delegate.h" | 17 #include "ui/message_center/notification_delegate.h" |
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 | 19 |
| 20 // These tests are disabled because WebUsbDetector::Initialize is a noop on |
| 21 // Windows due to jank and hangs caused by enumerating devices. |
| 22 // https://crbug.com/656702 |
| 23 #if !defined(OS_WIN) |
| 20 namespace { | 24 namespace { |
| 21 | 25 |
| 22 // USB device product name. | 26 // USB device product name. |
| 23 const char* kProductName_1 = "Google Product A"; | 27 const char* kProductName_1 = "Google Product A"; |
| 24 const char* kProductName_2 = "Google Product B"; | 28 const char* kProductName_2 = "Google Product B"; |
| 25 const char* kProductName_3 = "Google Product C"; | 29 const char* kProductName_3 = "Google Product C"; |
| 26 | 30 |
| 27 // USB device landing page. | 31 // USB device landing page. |
| 28 const char* kLandingPage_1 = "https://www.google.com/A"; | 32 const char* kLandingPage_1 = "https://www.google.com/A"; |
| 29 const char* kLandingPage_2 = "https://www.google.com/B"; | 33 const char* kLandingPage_2 = "https://www.google.com/B"; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 base::ASCIIToUTF16("Go to www.google.com/C to connect."); | 396 base::ASCIIToUTF16("Go to www.google.com/C to connect."); |
| 393 EXPECT_EQ(expected_message_3, notification_3->message()); | 397 EXPECT_EQ(expected_message_3, notification_3->message()); |
| 394 EXPECT_TRUE(notification_3->delegate() != nullptr); | 398 EXPECT_TRUE(notification_3->delegate() != nullptr); |
| 395 | 399 |
| 396 device_client_.usb_service()->RemoveDevice(device_1); | 400 device_client_.usb_service()->RemoveDevice(device_1); |
| 397 EXPECT_EQ(nullptr, message_center_->FindVisibleNotificationById(guid_1)); | 401 EXPECT_EQ(nullptr, message_center_->FindVisibleNotificationById(guid_1)); |
| 398 | 402 |
| 399 device_client_.usb_service()->RemoveDevice(device_3); | 403 device_client_.usb_service()->RemoveDevice(device_3); |
| 400 EXPECT_EQ(nullptr, message_center_->FindVisibleNotificationById(guid_3)); | 404 EXPECT_EQ(nullptr, message_center_->FindVisibleNotificationById(guid_3)); |
| 401 } | 405 } |
| 406 #endif // !OS_WIN |
| OLD | NEW |