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

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

Issue 11360200: Decouple bluetooth_event_router from extension_system. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed MockBluetoothSocket Created 8 years, 1 month 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 (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 <string.h> 5 #include <string.h>
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" 8 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h"
9 #include "chrome/browser/extensions/bluetooth_event_router.h" 9 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
11 #include "chrome/browser/extensions/extension_function_test_utils.h" 11 #include "chrome/browser/extensions/extension_function_test_utils.h"
12 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/extensions/extension_test_message_listener.h" 13 #include "chrome/browser/extensions/extension_test_message_listener.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
17 #include "device/bluetooth/bluetooth_adapter.h" 17 #include "device/bluetooth/bluetooth_adapter.h"
18 #include "device/bluetooth/bluetooth_out_of_band_pairing_data.h" 18 #include "device/bluetooth/bluetooth_out_of_band_pairing_data.h"
19 #include "device/bluetooth/test/mock_bluetooth_adapter.h" 19 #include "device/bluetooth/test/mock_bluetooth_adapter.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 function->set_has_callback(true); 90 function->set_has_callback(true);
91 return function; 91 return function;
92 } 92 }
93 93
94 protected: 94 protected:
95 testing::StrictMock<MockBluetoothAdapter>* mock_adapter_; 95 testing::StrictMock<MockBluetoothAdapter>* mock_adapter_;
96 scoped_ptr<testing::NiceMock<MockBluetoothDevice> > device1_; 96 scoped_ptr<testing::NiceMock<MockBluetoothDevice> > device1_;
97 scoped_ptr<testing::NiceMock<MockBluetoothDevice> > device2_; 97 scoped_ptr<testing::NiceMock<MockBluetoothDevice> > device2_;
98 98
99 extensions::ExtensionBluetoothEventRouter* event_router() { 99 extensions::ExtensionBluetoothEventRouter* event_router() {
100 return browser()->profile()->GetExtensionService()-> 100 return extensions::BluetoothAPI::Get(browser()->profile())
101 bluetooth_event_router(); 101 ->bluetooth_event_router();
102 } 102 }
103 103
104 private: 104 private:
105 scoped_refptr<Extension> empty_extension_; 105 scoped_refptr<Extension> empty_extension_;
106 }; 106 };
107 107
108 // This is the canonical UUID for the short UUID 0010. 108 // This is the canonical UUID for the short UUID 0010.
109 static const char kOutOfBandPairingDataHash[] = "0123456789ABCDEh"; 109 static const char kOutOfBandPairingDataHash[] = "0123456789ABCDEh";
110 static const char kOutOfBandPairingDataRandomizer[] = "0123456789ABCDEr"; 110 static const char kOutOfBandPairingDataRandomizer[] = "0123456789ABCDEr";
111 111
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // Load and wait for setup 451 // Load and wait for setup
452 ExtensionTestMessageListener listener("ready", true); 452 ExtensionTestMessageListener listener("ready", true);
453 ASSERT_TRUE(LoadExtension( 453 ASSERT_TRUE(LoadExtension(
454 test_data_dir_.AppendASCII("bluetooth/get_devices_error"))); 454 test_data_dir_.AppendASCII("bluetooth/get_devices_error")));
455 EXPECT_TRUE(listener.WaitUntilSatisfied()); 455 EXPECT_TRUE(listener.WaitUntilSatisfied());
456 456
457 listener.Reply("go"); 457 listener.Reply("go");
458 458
459 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 459 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
460 } 460 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698