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

Side by Side 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 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/weak_ptr.h"
6 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
7 #include "content/browser/intents/intent_injector.h" 8 #include "content/browser/intents/intent_injector.h"
8 #include "content/browser/intents/internal_web_intents_dispatcher.h" 9 #include "content/browser/intents/internal_web_intents_dispatcher.h"
9 #include "content/browser/renderer_host/test_render_view_host.h" 10 #include "content/browser/renderer_host/test_render_view_host.h"
10 #include "content/browser/web_contents/test_web_contents.h" 11 #include "content/browser/web_contents/test_web_contents.h"
11 #include "content/common/intents_messages.h" 12 #include "content/common/intents_messages.h"
12 #include "content/common/view_messages.h" 13 #include "content/common/view_messages.h"
13 #include "content/test/web_contents_tester.h" 14 #include "content/test/web_contents_tester.h"
14 #include "content/test/mock_render_process_host.h" 15 #include "content/test/mock_render_process_host.h"
15 #include "ipc/ipc_channel.h" 16 #include "ipc/ipc_channel.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 std::string()); 82 std::string());
82 ASSERT_TRUE(contents()->cross_navigation_pending()); 83 ASSERT_TRUE(contents()->cross_navigation_pending());
83 ASSERT_TRUE(pending_rvh()); 84 ASSERT_TRUE(pending_rvh());
84 injector->RenderViewCreated(pending_test_rvh()); 85 injector->RenderViewCreated(pending_test_rvh());
85 86
86 // The injector is still operating on the WebContents with the ddd.com 87 // The injector is still operating on the WebContents with the ddd.com
87 // initial page, so no intent data is sent to this new renderer. 88 // initial page, so no intent data is sent to this new renderer.
88 EXPECT_TRUE(NULL == process()->sink().GetFirstMessageMatching( 89 EXPECT_TRUE(NULL == process()->sink().GetFirstMessageMatching(
89 IntentsMsg_SetWebIntentData::ID)); 90 IntentsMsg_SetWebIntentData::ID));
90 } 91 }
92
93 TEST_F(IntentInjectorTest, AbandonDeletes) {
94 IntentInjector* injector = new IntentInjector(web_contents());
95
96 base::WeakPtr<IntentInjector> weak_injector =
97 injector->weak_factory_.GetWeakPtr();
98 EXPECT_FALSE(weak_injector.get() == NULL);
99 weak_injector->Abandon();
100 EXPECT_TRUE(weak_injector.get() == NULL);
101
102 // Clean up leftovers from the framework.
103 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.
104
105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698