Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: extensions/browser/guest_view/web_view/web_view_test_common.h

Issue 604443003: Adds more webview tests to app_shell_browsertests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include guards Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/guest_view/web_view/web_view_test_common.h
diff --git a/extensions/browser/guest_view/web_view/web_view_test_common.h b/extensions/browser/guest_view/web_view/web_view_test_common.h
new file mode 100644
index 0000000000000000000000000000000000000000..3a0b4dc526b46a38a037971046a8951c64233d66
--- /dev/null
+++ b/extensions/browser/guest_view/web_view/web_view_test_common.h
@@ -0,0 +1,55 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_TEST_COMMON_H_
Yoyo Zhou 2014/09/24 21:55:06 Why not call this test_guest_view_manager.h?
lfg 2014/09/24 22:17:08 Done.
+#define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_TEST_COMMON_H_
+
+#include "content/public/test/test_utils.h"
+#include "extensions/browser/guest_view/guest_view_manager.h"
+#include "extensions/browser/guest_view/guest_view_manager_factory.h"
+
+namespace extensions {
+
+class TestGuestViewManager : public GuestViewManager {
+ public:
+ explicit TestGuestViewManager(content::BrowserContext* context);
+ virtual ~TestGuestViewManager();
+
+ content::WebContents* WaitForGuestCreated();
+ void WaitForGuestDeleted();
+
+ private:
+ // GuestViewManager override:
+ virtual void AddGuest(int guest_instance_id,
+ content::WebContents* guest_web_contents) OVERRIDE;
+ virtual void RemoveGuest(int guest_instance_id) OVERRIDE;
+
+ bool seen_guest_removed_;
+ content::WebContents* web_contents_;
+ scoped_refptr<content::MessageLoopRunner> created_message_loop_runner_;
+ scoped_refptr<content::MessageLoopRunner> deleted_message_loop_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestGuestViewManager);
+};
+
+// Test factory for creating test instances of GuestViewManager.
+class TestGuestViewManagerFactory : public GuestViewManagerFactory {
+ public:
+ TestGuestViewManagerFactory();
+ virtual ~TestGuestViewManagerFactory();
+
+ virtual GuestViewManager* CreateGuestViewManager(
+ content::BrowserContext* context) OVERRIDE;
+
+ TestGuestViewManager* GetManager(content::BrowserContext* context);
+
+ private:
+ TestGuestViewManager* test_guest_view_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestGuestViewManagerFactory);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_TEST_COMMON_H_

Powered by Google App Engine
This is Rietveld 408576698