| Index: chrome/browser/apps/guest_view/extension_view_browsertest.cc
|
| diff --git a/chrome/browser/apps/guest_view/app_view_browsertest.cc b/chrome/browser/apps/guest_view/extension_view_browsertest.cc
|
| similarity index 57%
|
| copy from chrome/browser/apps/guest_view/app_view_browsertest.cc
|
| copy to chrome/browser/apps/guest_view/extension_view_browsertest.cc
|
| index 8ddc15d7d40942de10f6b32c8146a387422f5cc2..b374bd4fe7e252ca90433737c28ac4c43111a7aa 100644
|
| --- a/chrome/browser/apps/guest_view/app_view_browsertest.cc
|
| +++ b/chrome/browser/apps/guest_view/extension_view_browsertest.cc
|
| @@ -4,17 +4,11 @@
|
|
|
| #include "base/strings/stringprintf.h"
|
| #include "chrome/browser/apps/app_browsertest_util.h"
|
| -#include "content/public/browser/notification_service.h"
|
| -#include "content/public/browser/render_process_host.h"
|
| +#include "chrome/test/base/ui_test_utils.h"
|
| #include "content/public/test/browser_test_utils.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"
|
| -#include "extensions/common/switches.h"
|
| #include "extensions/test/extension_test_message_listener.h"
|
| -#include "net/test/embedded_test_server/embedded_test_server.h"
|
| -#include "net/test/embedded_test_server/http_request.h"
|
| -#include "net/test/embedded_test_server/http_response.h"
|
|
|
| namespace {
|
|
|
| @@ -34,11 +28,11 @@ class TestGuestViewManager : public extensions::GuestViewManager {
|
| }
|
|
|
| private:
|
| - // GuestViewManager override:
|
| + // GuestViewManager override.
|
| void AddGuest(int guest_instance_id,
|
| content::WebContents* guest_web_contents) override {
|
| - extensions::GuestViewManager::AddGuest(
|
| - guest_instance_id, guest_web_contents);
|
| + extensions::GuestViewManager::AddGuest(guest_instance_id,
|
| + guest_web_contents);
|
| web_contents_ = guest_web_contents;
|
|
|
| if (message_loop_runner_.get())
|
| @@ -52,8 +46,7 @@ class TestGuestViewManager : public extensions::GuestViewManager {
|
| // Test factory for creating test instances of GuestViewManager.
|
| class TestGuestViewManagerFactory : public extensions::GuestViewManagerFactory {
|
| public:
|
| - TestGuestViewManagerFactory() :
|
| - test_guest_view_manager_(NULL) {}
|
| + TestGuestViewManagerFactory() : test_guest_view_manager_(NULL) {}
|
|
|
| ~TestGuestViewManagerFactory() override {}
|
|
|
| @@ -77,9 +70,9 @@ class TestGuestViewManagerFactory : public extensions::GuestViewManagerFactory {
|
|
|
| } // namespace
|
|
|
| -class AppViewTest : public extensions::PlatformAppBrowserTest {
|
| +class ExtensionViewTest : public extensions::PlatformAppBrowserTest {
|
| public:
|
| - AppViewTest() {
|
| + ExtensionViewTest() {
|
| extensions::GuestViewManager::set_factory_for_testing(&factory_);
|
| }
|
|
|
| @@ -87,23 +80,9 @@ class AppViewTest : public extensions::PlatformAppBrowserTest {
|
| return factory_.GetManager(browser()->profile());
|
| }
|
|
|
| - enum TestServer {
|
| - NEEDS_TEST_SERVER,
|
| - NO_TEST_SERVER
|
| - };
|
| -
|
| void TestHelper(const std::string& test_name,
|
| const std::string& app_location,
|
| - const std::string& app_to_embed,
|
| - TestServer test_server) {
|
| - // For serving guest pages.
|
| - if (test_server == NEEDS_TEST_SERVER) {
|
| - if (!StartEmbeddedTestServer()) {
|
| - LOG(ERROR) << "FAILED TO START TEST SERVER.";
|
| - return;
|
| - }
|
| - }
|
| -
|
| + const std::string& app_to_embed) {
|
| LoadAndLaunchPlatformApp(app_location.c_str(), "Launched");
|
|
|
| // Flush any pending events to make sure we start with a clean slate.
|
| @@ -137,42 +116,16 @@ class AppViewTest : public extensions::PlatformAppBrowserTest {
|
| TestGuestViewManagerFactory factory_;
|
| };
|
|
|
| -// Tests that <appview> is able to navigate to another installed app.
|
| -IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewWithUndefinedDataShouldSucceed) {
|
| - const extensions::Extension* skeleton_app =
|
| - InstallPlatformApp("app_view/shim/skeleton");
|
| - TestHelper("testAppViewWithUndefinedDataShouldSucceed",
|
| - "app_view/shim",
|
| - skeleton_app->id(),
|
| - NO_TEST_SERVER);
|
| -}
|
| -
|
| -// Tests that <appview> correctly processes parameters passed on connect.
|
| -IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewRefusedDataShouldFail) {
|
| +// Tests that <extensionview> can be created and added to the DOM.
|
| +IN_PROC_BROWSER_TEST_F(ExtensionViewTest,
|
| + TestExtensionViewCreationShouldSucceed) {
|
| const extensions::Extension* skeleton_app =
|
| - InstallPlatformApp("app_view/shim/skeleton");
|
| - TestHelper("testAppViewRefusedDataShouldFail",
|
| - "app_view/shim",
|
| - skeleton_app->id(),
|
| - NO_TEST_SERVER);
|
| + InstallPlatformApp("extension_view/shim/skeleton");
|
| + TestHelper("testExtensionViewCreationShouldSucceed", "extension_view/shim",
|
| + skeleton_app->id());
|
| }
|
|
|
| -// Tests that <appview> correctly processes parameters passed on connect.
|
| -IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewGoodDataShouldSucceed) {
|
| - const extensions::Extension* skeleton_app =
|
| - InstallPlatformApp("app_view/shim/skeleton");
|
| - TestHelper("testAppViewGoodDataShouldSucceed",
|
| - "app_view/shim",
|
| - skeleton_app->id(),
|
| - NO_TEST_SERVER);
|
| -}
|
| -
|
| -// Tests that <appview> correctly handles multiple successive connects.
|
| -IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewMultipleConnects) {
|
| - const extensions::Extension* skeleton_app =
|
| - InstallPlatformApp("app_view/shim/skeleton");
|
| - TestHelper("testAppViewMultipleConnects",
|
| - "app_view/shim",
|
| - skeleton_app->id(),
|
| - NO_TEST_SERVER);
|
| +// Tests that verify that <extensionview> can navigate to different sources.
|
| +IN_PROC_BROWSER_TEST_F(ExtensionViewTest, ShimSrcAttribute) {
|
| + ASSERT_TRUE(RunPlatformAppTest("platform_apps/extension_view/src_attribute"));
|
| }
|
|
|