OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_ |
7 | 7 |
8 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
9 #include "content/public/test/browser_test_utils.h" | 9 #include "content/public/test/browser_test_utils.h" |
10 #include "content/public/test/test_utils.h" | 10 #include "content/public/test/test_utils.h" |
11 #include "extensions/browser/guest_view/guest_view_manager.h" | 11 #include "extensions/browser/guest_view/guest_view_manager.h" |
12 #include "extensions/browser/guest_view/guest_view_manager_factory.h" | 12 #include "extensions/browser/guest_view/guest_view_manager_factory.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 class TestGuestViewManager : public GuestViewManager { | 16 class TestGuestViewManager : public GuestViewManager { |
17 public: | 17 public: |
18 explicit TestGuestViewManager(content::BrowserContext* context); | 18 explicit TestGuestViewManager(content::BrowserContext* context); |
19 ~TestGuestViewManager() override; | 19 ~TestGuestViewManager() override; |
20 | 20 |
21 void WaitForAllGuestsDeleted(); | 21 void WaitForAllGuestsDeleted(); |
22 content::WebContents* WaitForSingleGuestCreated(); | 22 content::WebContents* WaitForSingleGuestCreated(); |
23 | 23 |
| 24 content::WebContents* GetLastGuestCreated(); |
| 25 |
24 private: | 26 private: |
25 // GuestViewManager override: | 27 // GuestViewManager override: |
26 void AddGuest(int guest_instance_id, | 28 void AddGuest(int guest_instance_id, |
27 content::WebContents* guest_web_contents) override; | 29 content::WebContents* guest_web_contents) override; |
28 void RemoveGuest(int guest_instance_id) override; | 30 void RemoveGuest(int guest_instance_id) override; |
29 | 31 |
30 int GetNumGuests() const; | 32 int GetNumGuests() const; |
31 content::WebContents* GetLastGuestCreated(); | |
32 void WaitForGuestCreated(); | 33 void WaitForGuestCreated(); |
33 | 34 |
34 std::vector<linked_ptr<content::WebContentsDestroyedWatcher>> | 35 std::vector<linked_ptr<content::WebContentsDestroyedWatcher>> |
35 guest_web_contents_watchers_; | 36 guest_web_contents_watchers_; |
36 scoped_refptr<content::MessageLoopRunner> created_message_loop_runner_; | 37 scoped_refptr<content::MessageLoopRunner> created_message_loop_runner_; |
37 | 38 |
38 DISALLOW_COPY_AND_ASSIGN(TestGuestViewManager); | 39 DISALLOW_COPY_AND_ASSIGN(TestGuestViewManager); |
39 }; | 40 }; |
40 | 41 |
41 // Test factory for creating test instances of GuestViewManager. | 42 // Test factory for creating test instances of GuestViewManager. |
42 class TestGuestViewManagerFactory : public GuestViewManagerFactory { | 43 class TestGuestViewManagerFactory : public GuestViewManagerFactory { |
43 public: | 44 public: |
44 TestGuestViewManagerFactory(); | 45 TestGuestViewManagerFactory(); |
45 ~TestGuestViewManagerFactory() override; | 46 ~TestGuestViewManagerFactory() override; |
46 | 47 |
47 GuestViewManager* CreateGuestViewManager( | 48 GuestViewManager* CreateGuestViewManager( |
48 content::BrowserContext* context) override; | 49 content::BrowserContext* context) override; |
49 | 50 |
50 TestGuestViewManager* GetManager(content::BrowserContext* context); | 51 TestGuestViewManager* GetManager(content::BrowserContext* context); |
51 | 52 |
52 private: | 53 private: |
53 TestGuestViewManager* test_guest_view_manager_; | 54 TestGuestViewManager* test_guest_view_manager_; |
54 | 55 |
55 DISALLOW_COPY_AND_ASSIGN(TestGuestViewManagerFactory); | 56 DISALLOW_COPY_AND_ASSIGN(TestGuestViewManagerFactory); |
56 }; | 57 }; |
57 | 58 |
58 } // namespace extensions | 59 } // namespace extensions |
59 | 60 |
60 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_ | 61 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_ |
OLD | NEW |