| OLD | NEW |
| 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/memory/weak_ptr.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "content/browser/intents/intent_injector.h" | 8 #include "content/browser/intents/intent_injector.h" |
| 9 #include "content/browser/intents/internal_web_intents_dispatcher.h" | 9 #include "content/browser/intents/internal_web_intents_dispatcher.h" |
| 10 #include "content/browser/renderer_host/test_render_view_host.h" | 10 #include "content/browser/renderer_host/test_render_view_host.h" |
| 11 #include "content/browser/web_contents/test_web_contents.h" | 11 #include "content/browser/web_contents/test_web_contents.h" |
| 12 #include "content/common/intents_messages.h" | 12 #include "content/common/intents_messages.h" |
| 13 #include "content/common/view_messages.h" | 13 #include "content/common/view_messages.h" |
| 14 #include "content/public/test/mock_render_process_host.h" | 14 #include "content/public/test/mock_render_process_host.h" |
| 15 #include "content/test/web_contents_tester.h" | 15 #include "content/public/test/web_contents_tester.h" |
| 16 #include "webkit/glue/web_intent_data.h" | 16 #include "webkit/glue/web_intent_data.h" |
| 17 #include "webkit/glue/web_intent_reply_data.h" | 17 #include "webkit/glue/web_intent_reply_data.h" |
| 18 | 18 |
| 19 class IntentInjectorTest : public content::RenderViewHostImplTestHarness { | 19 class IntentInjectorTest : public content::RenderViewHostImplTestHarness { |
| 20 public: | 20 public: |
| 21 IntentInjectorTest() { | 21 IntentInjectorTest() { |
| 22 webkit_glue::WebIntentData intent(ASCIIToUTF16("action"), | 22 webkit_glue::WebIntentData intent(ASCIIToUTF16("action"), |
| 23 ASCIIToUTF16("type"), | 23 ASCIIToUTF16("type"), |
| 24 ASCIIToUTF16("unserialized_data")); | 24 ASCIIToUTF16("unserialized_data")); |
| 25 // Will be destroyed when the IntentInjector shuts down. | 25 // Will be destroyed when the IntentInjector shuts down. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 EXPECT_FALSE(weak_injector.get() == NULL); | 96 EXPECT_FALSE(weak_injector.get() == NULL); |
| 97 weak_injector->Abandon(); | 97 weak_injector->Abandon(); |
| 98 EXPECT_TRUE(weak_injector.get() == NULL); | 98 EXPECT_TRUE(weak_injector.get() == NULL); |
| 99 | 99 |
| 100 // Sending a message will both auto-delete |dispatcher_| to clean up and | 100 // Sending a message will both auto-delete |dispatcher_| to clean up and |
| 101 // verify that messages don't get sent to the (now deleted) |injector|. | 101 // verify that messages don't get sent to the (now deleted) |injector|. |
| 102 dispatcher_->SendReplyMessage( | 102 dispatcher_->SendReplyMessage( |
| 103 webkit_glue::WEB_INTENT_SERVICE_CONTENTS_CLOSED, string16()); | 103 webkit_glue::WEB_INTENT_SERVICE_CONTENTS_CLOSED, string16()); |
| 104 | 104 |
| 105 } | 105 } |
| OLD | NEW |