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

Unified Diff: webkit/glue/plugins/pepper_resource_tracker.h

Issue 5685002: Make it possible to write simple unit tests for the pepper implementation. Th... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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
Index: webkit/glue/plugins/pepper_resource_tracker.h
===================================================================
--- webkit/glue/plugins/pepper_resource_tracker.h (revision 68719)
+++ webkit/glue/plugins/pepper_resource_tracker.h (working copy)
@@ -9,6 +9,7 @@
#include <utility>
#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
#include "base/hash_tables.h"
#include "base/ref_counted.h"
#include "base/singleton.h"
@@ -21,6 +22,7 @@
class PluginInstance;
class PluginModule;
class Resource;
+class ResourceTrackerTest;
// This class maintains a global list of all live pepper resources. It allows
// us to check resource ID validity and to map them to a specific module.
@@ -91,6 +93,7 @@
private:
friend struct DefaultSingletonTraits<ResourceTracker>;
friend class Resource;
+ friend class ResourceTrackerTest;
// Prohibit creation other then by the Singleton class.
ResourceTracker();
@@ -101,6 +104,15 @@
// Resource class.
PP_Resource AddResource(Resource* resource);
+ // Overrides the singleton object. This is used for tests which want to
+ // specify their own tracker (otherwise, you can get cross-talk between
+ // tests since the data will live into the subsequent tests).
+ static void SetSingletonOverride(ResourceTracker* tracker);
+ static void ClearSingletonOverride();
+
+ // See SetSingletonOverride above.
+ static ResourceTracker* singleton_override_;
+
// Last assigned resource ID.
PP_Resource last_id_;

Powered by Google App Engine
This is Rietveld 408576698