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

Side by Side Diff: chrome/browser/extensions/api/bluetooth/bluetooth_event_router_unittest.cc

Issue 13224004: Bluetooth: remove private members from BluetoothAdapter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix BluetoothApiTest.Events Created 7 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 | 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/bluetooth/bluetooth_event_router.h" 5 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h"
6 #include "chrome/test/base/testing_profile.h" 6 #include "chrome/test/base/testing_profile.h"
7 #include "device/bluetooth/test/mock_bluetooth_adapter.h" 7 #include "device/bluetooth/test/mock_bluetooth_adapter.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace {
12
13 const char* kAdapterAddress = "Mock Adapter address for testing";
14 const char* kName = "Mock Adapter name for testing";
15
16 } // namespace
17
18 namespace extensions { 11 namespace extensions {
19 12
20 class ExtensionBluetoothEventRouterTest : public testing::Test { 13 class ExtensionBluetoothEventRouterTest : public testing::Test {
21 public: 14 public:
22 ExtensionBluetoothEventRouterTest() 15 ExtensionBluetoothEventRouterTest()
Mark Mentovai 2013/04/02 18:05:27 This constructor should be explicit.
keybuk 2013/04/02 19:03:09 I'm confused as to why this would be explicit? ex
Mark Mentovai 2013/04/02 19:30:24 keybuk wrote:
23 : mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>( 16 : mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>),
youngki 2013/04/02 12:30:31 put parentheses () .
Mark Mentovai 2013/04/02 18:05:27 Nobody deletes this?
keybuk 2013/04/02 19:03:09 Done.
24 kAdapterAddress, kName)),
25 router_(&test_profile_) { 17 router_(&test_profile_) {
26 router_.SetAdapterForTest(mock_adapter_); 18 router_.SetAdapterForTest(mock_adapter_);
27 } 19 }
28 20
29 protected: 21 protected:
30 testing::StrictMock<device::MockBluetoothAdapter>* mock_adapter_; 22 testing::StrictMock<device::MockBluetoothAdapter>* mock_adapter_;
31 TestingProfile test_profile_; 23 TestingProfile test_profile_;
32 ExtensionBluetoothEventRouter router_; 24 ExtensionBluetoothEventRouter router_;
33 }; 25 };
34 26
35 TEST_F(ExtensionBluetoothEventRouterTest, BluetoothEventListener) { 27 TEST_F(ExtensionBluetoothEventRouterTest, BluetoothEventListener) {
36 router_.OnListenerAdded(); 28 router_.OnListenerAdded();
37 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)).Times(1); 29 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)).Times(1);
38 router_.OnListenerRemoved(); 30 router_.OnListenerRemoved();
39 } 31 }
40 32
41 TEST_F(ExtensionBluetoothEventRouterTest, MultipleBluetoothEventListeners) { 33 TEST_F(ExtensionBluetoothEventRouterTest, MultipleBluetoothEventListeners) {
42 router_.OnListenerAdded(); 34 router_.OnListenerAdded();
43 router_.OnListenerAdded(); 35 router_.OnListenerAdded();
44 router_.OnListenerAdded(); 36 router_.OnListenerAdded();
45 router_.OnListenerRemoved(); 37 router_.OnListenerRemoved();
46 router_.OnListenerRemoved(); 38 router_.OnListenerRemoved();
47 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)).Times(1); 39 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)).Times(1);
48 router_.OnListenerRemoved(); 40 router_.OnListenerRemoved();
49 } 41 }
50 42
51 } // namespace extensions 43 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698