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

Unified Diff: chrome/browser/extensions/test_extension_system.cc

Issue 10795052: Improve unit testing of socket API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tricky IO thread issues in a way that doesn't kill 50 other tests. Created 8 years, 5 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/browser/extensions/test_extension_system.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/test_extension_system.cc
diff --git a/chrome/browser/extensions/test_extension_system.cc b/chrome/browser/extensions/test_extension_system.cc
index c12984f9e078828f564f3f108006154f3ea63173..6bdb4543b28c7690ca06b10aa885196963d8ee5d 100644
--- a/chrome/browser/extensions/test_extension_system.cc
+++ b/chrome/browser/extensions/test_extension_system.cc
@@ -19,6 +19,9 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/value_store/testing_value_store.h"
#include "chrome/common/chrome_switches.h"
+#include "content/public/browser/browser_thread.h"
+
+using content::BrowserThread;
namespace extensions {
@@ -43,6 +46,17 @@ void TestExtensionSystem::CreateAlarmManager(
alarm_manager_.reset(new AlarmManager(profile_, now));
}
+void TestExtensionSystem::CreateSocketManager() {
+ // Note that we're intentionally creating the socket manager on the wrong
+ // thread (not the IO thread). This is because we don't want to presume or
+ // require that there be an IO thread in a lightweight test context. If we do
+ // need thread-specific behavior someday, we'll probably need something like
+ // CreateSocketManagerOnThreadForTesting(thread_id). But not today.
+ BrowserThread::ID id;
+ DCHECK(BrowserThread::GetCurrentThreadIdentifier(&id));
+ socket_manager_.reset(new ApiResourceManager<Socket>(id));
+}
+
ExtensionService* TestExtensionSystem::CreateExtensionService(
const CommandLine* command_line,
const FilePath& install_directory,
@@ -138,7 +152,7 @@ TestExtensionSystem::serial_connection_manager() {
}
ApiResourceManager<Socket>*TestExtensionSystem::socket_manager() {
- return NULL;
+ return socket_manager_.get();
}
ApiResourceManager<UsbDeviceResource>*
« no previous file with comments | « chrome/browser/extensions/test_extension_system.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698