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

Unified Diff: extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc

Issue 544753003: Move BluetoothEventRouterTest to extensions_unittests suite (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | extensions/browser/test_extensions_browser_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
diff --git a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
index 4d336b7007fa2c265e10e167b5ad4ecc6c8ee080..0d6c245030891710579e66f420eeca9117a35e3e 100644
--- a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
+++ b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
@@ -8,16 +8,14 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
-#include "chrome/browser/extensions/test_extension_system.h"
-#include "chrome/test/base/testing_profile.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_browser_thread.h"
-#include "content/public/test/test_browser_thread_bundle.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "device/bluetooth/test/mock_bluetooth_adapter.h"
-#include "device/bluetooth/test/mock_bluetooth_device.h"
#include "extensions/browser/api/bluetooth/bluetooth_event_router.h"
-#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_registry.h"
+#include "extensions/browser/extensions_test.h"
#include "extensions/common/api/bluetooth.h"
#include "extensions/common/extension_builder.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -35,26 +33,21 @@ namespace extensions {
namespace bluetooth = core_api::bluetooth;
-class BluetoothEventRouterTest : public testing::Test {
+class BluetoothEventRouterTest : public ExtensionsTest {
public:
BluetoothEventRouterTest()
: ui_thread_(content::BrowserThread::UI, &message_loop_),
mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()),
- test_profile_(new TestingProfile()),
- router_(new BluetoothEventRouter(test_profile_.get())) {
+ notification_service_(content::NotificationService::Create()),
+ router_(new BluetoothEventRouter(browser_context())) {
router_->SetAdapterForTest(mock_adapter_);
}
virtual void TearDown() OVERRIDE {
- // Some profile-dependent services rely on UI thread to clean up. We make
- // sure they are properly cleaned up by running the UI message loop until
- // idle.
- // It's important to destroy the router before the |test_profile_| so it
- // removes itself as an observer.
+ // It's important to destroy the router before the browser context keyed
+ // services so it removes itself as an ExtensionRegistry observer.
router_.reset(NULL);
- test_profile_.reset(NULL);
- base::RunLoop run_loop;
- run_loop.RunUntilIdle();
James Cook 2014/09/04 18:09:12 This appears unnecessary. I think it was there bec
+ ExtensionsTest::TearDown();
}
protected:
@@ -62,7 +55,7 @@ class BluetoothEventRouterTest : public testing::Test {
// Note: |ui_thread_| must be declared before |router_|.
content::TestBrowserThread ui_thread_;
testing::StrictMock<device::MockBluetoothAdapter>* mock_adapter_;
- scoped_ptr<TestingProfile> test_profile_;
+ scoped_ptr<content::NotificationService> notification_service_;
scoped_ptr<BluetoothEventRouter> router_;
};
@@ -83,16 +76,16 @@ TEST_F(BluetoothEventRouterTest, MultipleBluetoothEventListeners) {
}
TEST_F(BluetoothEventRouterTest, UnloadExtension) {
- scoped_refptr<const extensions::Extension> extension =
- extensions::ExtensionBuilder()
- .SetManifest(extensions::DictionaryBuilder()
+ scoped_refptr<const Extension> extension =
+ ExtensionBuilder()
+ .SetManifest(DictionaryBuilder()
.Set("name", "BT event router test")
.Set("version", "1.0")
.Set("manifest_version", 2))
.SetID(kTestExtensionId)
.Build();
- ExtensionRegistry::Get(test_profile_.get())->TriggerOnUnloaded(
+ ExtensionRegistry::Get(browser_context())->TriggerOnUnloaded(
extension.get(), UnloadedExtensionInfo::REASON_DISABLE);
EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)).Times(1);
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | extensions/browser/test_extensions_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698