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

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

Issue 624153002: replace OVERRIDE and FINAL with override and final in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "base/run_loop.h" 5 #include "base/run_loop.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "base/test/values_test_util.h" 7 #include "base/test/values_test_util.h"
8 #include "chrome/browser/extensions/test_extension_environment.h" 8 #include "chrome/browser/extensions/test_extension_environment.h"
9 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
10 #include "device/usb/usb_device.h" 10 #include "device/usb/usb_device.h"
(...skipping 19 matching lines...) Expand all
30 30
31 MOCK_METHOD0(Open, scoped_refptr<UsbDeviceHandle>()); 31 MOCK_METHOD0(Open, scoped_refptr<UsbDeviceHandle>());
32 MOCK_METHOD1(Close, bool(scoped_refptr<UsbDeviceHandle>)); 32 MOCK_METHOD1(Close, bool(scoped_refptr<UsbDeviceHandle>));
33 #if defined(OS_CHROMEOS) 33 #if defined(OS_CHROMEOS)
34 MOCK_METHOD2(RequestUsbAccess, void(int, const base::Callback<void(bool)>&)); 34 MOCK_METHOD2(RequestUsbAccess, void(int, const base::Callback<void(bool)>&));
35 #endif 35 #endif
36 MOCK_METHOD0(GetConfiguration, const device::UsbConfigDescriptor&()); 36 MOCK_METHOD0(GetConfiguration, const device::UsbConfigDescriptor&());
37 MOCK_METHOD1(GetManufacturer, bool(base::string16*)); 37 MOCK_METHOD1(GetManufacturer, bool(base::string16*));
38 MOCK_METHOD1(GetProduct, bool(base::string16*)); 38 MOCK_METHOD1(GetProduct, bool(base::string16*));
39 39
40 virtual bool GetSerialNumber(base::string16* serial_number) OVERRIDE { 40 virtual bool GetSerialNumber(base::string16* serial_number) override {
41 if (serial_number_.empty()) { 41 if (serial_number_.empty()) {
42 return false; 42 return false;
43 } 43 }
44 44
45 *serial_number = base::UTF8ToUTF16(serial_number_); 45 *serial_number = base::UTF8ToUTF16(serial_number_);
46 return true; 46 return true;
47 } 47 }
48 48
49 void NotifyDisconnect() { UsbDevice::NotifyDisconnect(); } 49 void NotifyDisconnect() { UsbDevice::NotifyDisconnect(); }
50 50
51 private: 51 private:
52 virtual ~MockUsbDevice() {} 52 virtual ~MockUsbDevice() {}
53 53
54 const std::string serial_number_; 54 const std::string serial_number_;
55 }; 55 };
56 56
57 } // namespace 57 } // namespace
58 58
59 class DevicePermissionsManagerTest : public testing::Test { 59 class DevicePermissionsManagerTest : public testing::Test {
60 protected: 60 protected:
61 virtual void SetUp() OVERRIDE { 61 virtual void SetUp() override {
62 testing::Test::SetUp(); 62 testing::Test::SetUp();
63 env_.GetExtensionPrefs(); // Force creation before adding extensions. 63 env_.GetExtensionPrefs(); // Force creation before adding extensions.
64 extension_ = env_.MakeExtension(*base::test::ParseJson( 64 extension_ = env_.MakeExtension(*base::test::ParseJson(
65 "{" 65 "{"
66 " \"app\": {" 66 " \"app\": {"
67 " \"background\": {" 67 " \"background\": {"
68 " \"scripts\": [\"background.js\"]" 68 " \"scripts\": [\"background.js\"]"
69 " }" 69 " }"
70 " }," 70 " },"
71 " \"permissions\": [" 71 " \"permissions\": ["
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 DevicePermissionsManager::Get(env_.profile()); 139 DevicePermissionsManager::Get(env_.profile());
140 scoped_ptr<DevicePermissions> device_permissions = 140 scoped_ptr<DevicePermissions> device_permissions =
141 manager->GetForExtension(extension_->id()); 141 manager->GetForExtension(extension_->id());
142 ASSERT_TRUE(device_permissions->CheckUsbDevice(device0)); 142 ASSERT_TRUE(device_permissions->CheckUsbDevice(device0));
143 ASSERT_FALSE(device_permissions->CheckUsbDevice(device1)); 143 ASSERT_FALSE(device_permissions->CheckUsbDevice(device1));
144 ASSERT_FALSE(device_permissions->CheckUsbDevice(device2)); 144 ASSERT_FALSE(device_permissions->CheckUsbDevice(device2));
145 ASSERT_FALSE(device_permissions->CheckUsbDevice(device3)); 145 ASSERT_FALSE(device_permissions->CheckUsbDevice(device3));
146 } 146 }
147 147
148 } // namespace extensions 148 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698