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

Side by Side Diff: extensions/browser/api/bluetooth_socket/bluetooth_socket_apitest.cc

Issue 569493003: Remove CreateEmptyExtension from extension_function_test_utils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 <string> 5 #include <string>
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/extension_function_test_utils.h"
11 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_test_message_listener.h" 11 #include "chrome/browser/extensions/extension_test_message_listener.h"
13 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
14 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
15 #include "device/bluetooth/bluetooth_adapter_factory.h" 14 #include "device/bluetooth/bluetooth_adapter_factory.h"
16 #include "device/bluetooth/bluetooth_uuid.h" 15 #include "device/bluetooth/bluetooth_uuid.h"
17 #include "device/bluetooth/test/mock_bluetooth_adapter.h" 16 #include "device/bluetooth/test/mock_bluetooth_adapter.h"
18 #include "device/bluetooth/test/mock_bluetooth_device.h" 17 #include "device/bluetooth/test/mock_bluetooth_device.h"
19 #include "device/bluetooth/test/mock_bluetooth_socket.h" 18 #include "device/bluetooth/test/mock_bluetooth_socket.h"
20 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h" 19 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h"
20 #include "extensions/common/test_util.h"
21 #include "extensions/test/result_catcher.h" 21 #include "extensions/test/result_catcher.h"
22 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
23 23
24 using device::BluetoothAdapter; 24 using device::BluetoothAdapter;
25 using device::BluetoothAdapterFactory; 25 using device::BluetoothAdapterFactory;
26 using device::BluetoothDevice; 26 using device::BluetoothDevice;
27 using device::BluetoothSocket; 27 using device::BluetoothSocket;
28 using device::BluetoothUUID; 28 using device::BluetoothUUID;
29 using device::MockBluetoothAdapter; 29 using device::MockBluetoothAdapter;
30 using device::MockBluetoothDevice; 30 using device::MockBluetoothDevice;
31 using device::MockBluetoothSocket; 31 using device::MockBluetoothSocket;
32 using extensions::Extension; 32 using extensions::Extension;
33 using extensions::ResultCatcher; 33 using extensions::ResultCatcher;
34 34
35 namespace utils = extension_function_test_utils;
36 namespace api = extensions::core_api; 35 namespace api = extensions::core_api;
37 36
38 namespace { 37 namespace {
39 38
40 class BluetoothSocketApiTest : public ExtensionApiTest { 39 class BluetoothSocketApiTest : public ExtensionApiTest {
41 public: 40 public:
42 BluetoothSocketApiTest() {} 41 BluetoothSocketApiTest() {}
43 42
44 virtual void SetUpOnMainThread() OVERRIDE { 43 virtual void SetUpOnMainThread() OVERRIDE {
45 ExtensionApiTest::SetUpOnMainThread(); 44 ExtensionApiTest::SetUpOnMainThread();
46 empty_extension_ = utils::CreateEmptyExtension(); 45 empty_extension_ = extensions::test_util::CreateEmptyExtension();
47 SetUpMockAdapter(); 46 SetUpMockAdapter();
48 } 47 }
49 48
50 void SetUpMockAdapter() { 49 void SetUpMockAdapter() {
51 // The browser will clean this up when it is torn down. 50 // The browser will clean this up when it is torn down.
52 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>(); 51 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>();
53 BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter_); 52 BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter_);
54 53
55 mock_device1_.reset( 54 mock_device1_.reset(
56 new testing::NiceMock<MockBluetoothDevice>(mock_adapter_.get(), 55 new testing::NiceMock<MockBluetoothDevice>(mock_adapter_.get(),
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 catcher.RestrictToBrowserContext(browser()->profile()); 211 catcher.RestrictToBrowserContext(browser()->profile());
213 212
214 // Run the test. 213 // Run the test.
215 scoped_refptr<const Extension> extension( 214 scoped_refptr<const Extension> extension(
216 LoadExtension(test_data_dir_.AppendASCII( 215 LoadExtension(test_data_dir_.AppendASCII(
217 "bluetooth_socket/permission_denied"))); 216 "bluetooth_socket/permission_denied")));
218 ASSERT_TRUE(extension.get()); 217 ASSERT_TRUE(extension.get());
219 218
220 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 219 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
221 } 220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698