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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_
6 #define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_
8 #include "base/compiler_specific.h"
9 #include "base/gtest_prod_util.h"
10 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
11 #include "content/public/test/test_utils.h"
13 FORWARD_DECLARE_TEST(BrowserPluginHostTest
, ReloadEmbedder
);
17 class WebContentsImpl
;
19 // Test class for BrowserPluginGuestManager.
21 // Provides utilities to wait for certain state/messages in
22 // BrowserPluginGuestManager to be used in tests.
23 class TestBrowserPluginGuestManager
: public BrowserPluginGuestManager
{
25 typedef BrowserPluginGuestManager::GuestInstanceMap GuestInstanceMap
;
27 TestBrowserPluginGuestManager();
28 virtual ~TestBrowserPluginGuestManager();
30 const GuestInstanceMap
& guest_web_contents_for_testing() const {
31 return guest_web_contents_by_instance_id_
;
34 // Waits until at least one guest is added to the guest manager.
35 void WaitForGuestAdded();
38 // BrowserPluginHostTest.ReloadEmbedder needs access to the GuestInstanceMap.
39 FRIEND_TEST_ALL_PREFIXES(BrowserPluginHostTest
, ReloadEmbedder
);
41 // Overriden to intercept in test.
42 virtual void AddGuest(int instance_id
,
43 WebContentsImpl
* guest_web_contents
) OVERRIDE
;
45 scoped_refptr
<MessageLoopRunner
> message_loop_runner_
;
46 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuestManager
);
49 } // namespace content
51 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_