| 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 #include "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "chrome/browser/apps/app_browsertest_util.h" | 6 #include "chrome/browser/apps/app_browsertest_util.h" |
| 7 #include "components/guest_view/browser/guest_view_manager.h" |
| 8 #include "components/guest_view/browser/guest_view_manager_factory.h" |
| 9 #include "components/guest_view/browser/test_guest_view_manager.h" |
| 7 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
| 8 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
| 9 #include "content/public/test/browser_test_utils.h" | 12 #include "content/public/test/browser_test_utils.h" |
| 10 #include "content/public/test/test_utils.h" | 13 #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" | |
| 13 #include "extensions/browser/guest_view/test_guest_view_manager.h" | |
| 14 #include "extensions/common/switches.h" | 14 #include "extensions/common/switches.h" |
| 15 #include "extensions/test/extension_test_message_listener.h" | 15 #include "extensions/test/extension_test_message_listener.h" |
| 16 #include "net/test/embedded_test_server/embedded_test_server.h" | 16 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 17 #include "net/test/embedded_test_server/http_request.h" | 17 #include "net/test/embedded_test_server/http_request.h" |
| 18 #include "net/test/embedded_test_server/http_response.h" | 18 #include "net/test/embedded_test_server/http_response.h" |
| 19 | 19 |
| 20 using guestview::GuestViewManager; |
| 21 using guestview::TestGuestViewManagerFactory; |
| 22 |
| 20 class AppViewTest : public extensions::PlatformAppBrowserTest { | 23 class AppViewTest : public extensions::PlatformAppBrowserTest { |
| 21 public: | 24 public: |
| 22 AppViewTest() { | 25 AppViewTest() { |
| 23 extensions::GuestViewManager::set_factory_for_testing(&factory_); | 26 GuestViewManager::set_factory_for_testing(&factory_); |
| 24 } | 27 } |
| 25 | 28 |
| 26 enum TestServer { | 29 enum TestServer { |
| 27 NEEDS_TEST_SERVER, | 30 NEEDS_TEST_SERVER, |
| 28 NO_TEST_SERVER | 31 NO_TEST_SERVER |
| 29 }; | 32 }; |
| 30 | 33 |
| 31 void TestHelper(const std::string& test_name, | 34 void TestHelper(const std::string& test_name, |
| 32 const std::string& app_location, | 35 const std::string& app_location, |
| 33 const std::string& app_to_embed, | 36 const std::string& app_to_embed, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 63 return; | 66 return; |
| 64 } | 67 } |
| 65 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | 68 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); |
| 66 } | 69 } |
| 67 | 70 |
| 68 private: | 71 private: |
| 69 void SetUpCommandLine(base::CommandLine* command_line) override { | 72 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 70 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); | 73 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 71 } | 74 } |
| 72 | 75 |
| 73 extensions::TestGuestViewManagerFactory factory_; | 76 TestGuestViewManagerFactory factory_; |
| 74 }; | 77 }; |
| 75 | 78 |
| 76 // Tests that <appview> is able to navigate to another installed app. | 79 // Tests that <appview> is able to navigate to another installed app. |
| 77 IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewWithUndefinedDataShouldSucceed) { | 80 IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewWithUndefinedDataShouldSucceed) { |
| 78 const extensions::Extension* skeleton_app = | 81 const extensions::Extension* skeleton_app = |
| 79 InstallPlatformApp("app_view/shim/skeleton"); | 82 InstallPlatformApp("app_view/shim/skeleton"); |
| 80 TestHelper("testAppViewWithUndefinedDataShouldSucceed", | 83 TestHelper("testAppViewWithUndefinedDataShouldSucceed", |
| 81 "app_view/shim", | 84 "app_view/shim", |
| 82 skeleton_app->id(), | 85 skeleton_app->id(), |
| 83 NO_TEST_SERVER); | 86 NO_TEST_SERVER); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 105 | 108 |
| 106 // Tests that <appview> correctly handles multiple successive connects. | 109 // Tests that <appview> correctly handles multiple successive connects. |
| 107 IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewMultipleConnects) { | 110 IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewMultipleConnects) { |
| 108 const extensions::Extension* skeleton_app = | 111 const extensions::Extension* skeleton_app = |
| 109 InstallPlatformApp("app_view/shim/skeleton"); | 112 InstallPlatformApp("app_view/shim/skeleton"); |
| 110 TestHelper("testAppViewMultipleConnects", | 113 TestHelper("testAppViewMultipleConnects", |
| 111 "app_view/shim", | 114 "app_view/shim", |
| 112 skeleton_app->id(), | 115 skeleton_app->id(), |
| 113 NO_TEST_SERVER); | 116 NO_TEST_SERVER); |
| 114 } | 117 } |
| OLD | NEW |