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

Side by Side Diff: chrome/browser/extensions/api/device_permissions_manager_unittest.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/test/values_test_util.h" 9 #include "base/test/values_test_util.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 device_client_.hid_service()->AddDevice(device6_); 75 device_client_.hid_service()->AddDevice(device6_);
76 device7_ = 76 device7_ =
77 new HidDeviceInfo(kTestDeviceIds[3], 0, 0, "Test HID Device", "", 77 new HidDeviceInfo(kTestDeviceIds[3], 0, 0, "Test HID Device", "",
78 device::kHIDBusTypeUSB, std::vector<uint8_t>()); 78 device::kHIDBusTypeUSB, std::vector<uint8_t>());
79 device_client_.hid_service()->AddDevice(device7_); 79 device_client_.hid_service()->AddDevice(device7_);
80 device_client_.hid_service()->FirstEnumerationComplete(); 80 device_client_.hid_service()->FirstEnumerationComplete();
81 } 81 }
82 82
83 void TearDown() override { env_.reset(nullptr); } 83 void TearDown() override { env_.reset(nullptr); }
84 84
85 scoped_ptr<extensions::TestExtensionEnvironment> env_; 85 std::unique_ptr<extensions::TestExtensionEnvironment> env_;
86 const extensions::Extension* extension_; 86 const extensions::Extension* extension_;
87 device::MockDeviceClient device_client_; 87 device::MockDeviceClient device_client_;
88 scoped_refptr<MockUsbDevice> device0_; 88 scoped_refptr<MockUsbDevice> device0_;
89 scoped_refptr<MockUsbDevice> device1_; 89 scoped_refptr<MockUsbDevice> device1_;
90 scoped_refptr<MockUsbDevice> device2_; 90 scoped_refptr<MockUsbDevice> device2_;
91 scoped_refptr<MockUsbDevice> device3_; 91 scoped_refptr<MockUsbDevice> device3_;
92 scoped_refptr<HidDeviceInfo> device4_; 92 scoped_refptr<HidDeviceInfo> device4_;
93 scoped_refptr<HidDeviceInfo> device5_; 93 scoped_refptr<HidDeviceInfo> device5_;
94 scoped_refptr<HidDeviceInfo> device6_; 94 scoped_refptr<HidDeviceInfo> device6_;
95 scoped_refptr<HidDeviceInfo> device7_; 95 scoped_refptr<HidDeviceInfo> device7_;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 device_permissions->FindHidDeviceEntry(device4_); 275 device_permissions->FindHidDeviceEntry(device4_);
276 EXPECT_TRUE(device4_entry->last_used().is_null()); 276 EXPECT_TRUE(device4_entry->last_used().is_null());
277 277
278 manager->UpdateLastUsed(extension_->id(), device0_entry); 278 manager->UpdateLastUsed(extension_->id(), device0_entry);
279 EXPECT_FALSE(device0_entry->last_used().is_null()); 279 EXPECT_FALSE(device0_entry->last_used().is_null());
280 manager->UpdateLastUsed(extension_->id(), device4_entry); 280 manager->UpdateLastUsed(extension_->id(), device4_entry);
281 EXPECT_FALSE(device4_entry->last_used().is_null()); 281 EXPECT_FALSE(device4_entry->last_used().is_null());
282 } 282 }
283 283
284 TEST_F(DevicePermissionsManagerTest, LoadPrefs) { 284 TEST_F(DevicePermissionsManagerTest, LoadPrefs) {
285 scoped_ptr<base::Value> prefs_value = base::test::ParseJson( 285 std::unique_ptr<base::Value> prefs_value = base::test::ParseJson(
286 "[" 286 "["
287 " {" 287 " {"
288 " \"manufacturer_string\": \"Test Manufacturer\"," 288 " \"manufacturer_string\": \"Test Manufacturer\","
289 " \"product_id\": 0," 289 " \"product_id\": 0,"
290 " \"product_string\": \"Test Product\"," 290 " \"product_string\": \"Test Product\","
291 " \"serial_number\": \"ABCDE\"," 291 " \"serial_number\": \"ABCDE\","
292 " \"type\": \"usb\"," 292 " \"type\": \"usb\","
293 " \"vendor_id\": 0" 293 " \"vendor_id\": 0"
294 " }," 294 " },"
295 " {" 295 " {"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 EXPECT_EQ(base::ASCIIToUTF16("Widget"), 387 EXPECT_EQ(base::ASCIIToUTF16("Widget"),
388 DevicePermissionsManager::GetPermissionMessage( 388 DevicePermissionsManager::GetPermissionMessage(
389 0x0001, 0x0000, manufacturer, product, empty, false)); 389 0x0001, 0x0000, manufacturer, product, empty, false));
390 390
391 EXPECT_EQ(base::ASCIIToUTF16("Widget (serial number A)"), 391 EXPECT_EQ(base::ASCIIToUTF16("Widget (serial number A)"),
392 DevicePermissionsManager::GetPermissionMessage( 392 DevicePermissionsManager::GetPermissionMessage(
393 0x0001, 0x0000, manufacturer, product, serial_number, false)); 393 0x0001, 0x0000, manufacturer, product, serial_number, false));
394 } 394 }
395 395
396 } // namespace extensions 396 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698