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

Unified Diff: content/browser/intents/intent_injector_unittest.cc

Issue 10218009: Allow severing connection between dispatcher and injector (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/intents/intent_injector_unittest.cc
diff --git a/content/browser/intents/intent_injector_unittest.cc b/content/browser/intents/intent_injector_unittest.cc
index 657df55b24ad3bd519a86f6308d1db122adbc9ee..f59ad86d364bba8b16528c8e5d6eea21a66328e4 100644
--- a/content/browser/intents/intent_injector_unittest.cc
+++ b/content/browser/intents/intent_injector_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/bind.h"
+#include "base/memory/weak_ptr.h"
#include "base/utf_string_conversions.h"
#include "content/browser/intents/intent_injector.h"
#include "content/browser/intents/internal_web_intents_dispatcher.h"
@@ -88,3 +89,17 @@ TEST_F(IntentInjectorTest, TestDispatchLimitedToSameOrigin) {
EXPECT_TRUE(NULL == process()->sink().GetFirstMessageMatching(
IntentsMsg_SetWebIntentData::ID));
}
+
+TEST_F(IntentInjectorTest, AbandonDeletes) {
+ IntentInjector* injector = new IntentInjector(web_contents());
+
+ base::WeakPtr<IntentInjector> weak_injector =
+ injector->weak_factory_.GetWeakPtr();
+ EXPECT_FALSE(weak_injector.get() == NULL);
+ weak_injector->Abandon();
+ EXPECT_TRUE(weak_injector.get() == NULL);
+
+ // Clean up leftovers from the framework.
+ delete dispatcher_;
Greg Billock 2012/04/25 14:26:52 Instead, call the dispatcher->SendReplyMessage. Th
groby-ooo-7-16 2012/04/25 16:40:10 Done.
+
+}

Powered by Google App Engine
This is Rietveld 408576698