Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / extensions / browser / guest_view / test_guest_view_manager.h
blob283eabba9970f5b9a57360c36c776de65e1bd047
1 // Copyright 2014 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 EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_
8 #include "base/memory/linked_ptr.h"
9 #include "content/public/test/browser_test_utils.h"
10 #include "content/public/test/test_utils.h"
11 #include "extensions/browser/guest_view/guest_view_manager.h"
12 #include "extensions/browser/guest_view/guest_view_manager_factory.h"
14 namespace extensions {
16 class TestGuestViewManager : public GuestViewManager {
17 public:
18 explicit TestGuestViewManager(content::BrowserContext* context);
19 ~TestGuestViewManager() override;
21 void WaitForAllGuestsDeleted();
22 content::WebContents* WaitForSingleGuestCreated();
24 private:
25 // GuestViewManager override:
26 void AddGuest(int guest_instance_id,
27 content::WebContents* guest_web_contents) override;
28 void RemoveGuest(int guest_instance_id) override;
30 int GetNumGuests() const;
31 content::WebContents* GetLastGuestCreated();
32 void WaitForGuestCreated();
34 std::vector<linked_ptr<content::WebContentsDestroyedWatcher>>
35 guest_web_contents_watchers_;
36 scoped_refptr<content::MessageLoopRunner> created_message_loop_runner_;
38 DISALLOW_COPY_AND_ASSIGN(TestGuestViewManager);
41 // Test factory for creating test instances of GuestViewManager.
42 class TestGuestViewManagerFactory : public GuestViewManagerFactory {
43 public:
44 TestGuestViewManagerFactory();
45 ~TestGuestViewManagerFactory() override;
47 GuestViewManager* CreateGuestViewManager(
48 content::BrowserContext* context) override;
50 TestGuestViewManager* GetManager(content::BrowserContext* context);
52 private:
53 TestGuestViewManager* test_guest_view_manager_;
55 DISALLOW_COPY_AND_ASSIGN(TestGuestViewManagerFactory);
58 } // namespace extensions
60 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_