| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_ | 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h" | 10 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h" |
| 11 #include "content/public/test/test_utils.h" | 11 #include "content/public/test/test_utils.h" |
| 12 | 12 |
| 13 FORWARD_DECLARE_TEST(BrowserPluginHostTest, ReloadEmbedder); | 13 FORWARD_DECLARE_TEST(BrowserPluginHostTest, ReloadEmbedder); |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 class WebContentsImpl; | 17 class WebContentsImpl; |
| 18 | 18 |
| 19 // Test class for BrowserPluginGuestManager. | 19 // Test class for BrowserPluginGuestManager. |
| 20 // | 20 // |
| 21 // Provides utilities to wait for certain state/messages in | 21 // Provides utilities to wait for certain state/messages in |
| 22 // BrowserPluginGuestManager to be used in tests. | 22 // BrowserPluginGuestManager to be used in tests. |
| 23 class TestBrowserPluginGuestManager : public BrowserPluginGuestManager { | 23 class TestBrowserPluginGuestManager : public BrowserPluginGuestManager { |
| 24 public: | 24 public: |
| 25 explicit TestBrowserPluginGuestManager(BrowserContext* context); | 25 explicit TestBrowserPluginGuestManager(BrowserContext* context); |
| 26 virtual ~TestBrowserPluginGuestManager(); | 26 virtual ~TestBrowserPluginGuestManager(); |
| 27 | 27 |
| 28 // Overriden to intercept in test. |
| 29 virtual BrowserPluginGuest* CreateGuest( |
| 30 SiteInstance* embedder_site_instance, |
| 31 int instance_id, |
| 32 const std::string& storage_partition_id, |
| 33 bool persist_storage, |
| 34 scoped_ptr<base::DictionaryValue> extra_params) OVERRIDE; |
| 35 |
| 28 // Waits until at least one guest is added to the guest manager. | 36 // Waits until at least one guest is added to the guest manager. |
| 29 WebContents* WaitForGuestAdded(); | 37 WebContents* WaitForGuestAdded(); |
| 30 | 38 |
| 31 private: | 39 private: |
| 32 // BrowserPluginHostTest.ReloadEmbedder needs access to the GuestInstanceMap. | 40 // BrowserPluginHostTest.ReloadEmbedder needs access to the GuestInstanceMap. |
| 33 FRIEND_TEST_ALL_PREFIXES(BrowserPluginHostTest, ReloadEmbedder); | 41 FRIEND_TEST_ALL_PREFIXES(BrowserPluginHostTest, ReloadEmbedder); |
| 34 | 42 |
| 35 // Overriden to intercept in test. | |
| 36 virtual void AddGuest(int instance_id, | |
| 37 WebContents* guest_web_contents) OVERRIDE; | |
| 38 | |
| 39 WebContents* last_guest_added_; | 43 WebContents* last_guest_added_; |
| 40 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 44 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
| 41 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuestManager); | 45 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuestManager); |
| 42 }; | 46 }; |
| 43 | 47 |
| 44 } // namespace content | 48 } // namespace content |
| 45 | 49 |
| 46 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_ | 50 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_ |
| OLD | NEW |