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

Unified Diff: chrome/browser/apps/guest_view/extension_view_browsertest.cc

Issue 873933002: Add <extensionview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move test files out of shim/ directory Created 5 years, 11 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
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 54%
copy from chrome/browser/apps/guest_view/app_view_browsertest.cc
copy to chrome/browser/apps/guest_view/extension_view_browsertest.cc
index 8ddc15d7d40942de10f6b32c8146a387422f5cc2..b0eb37cd3d76f60432730a68be49b79356c6273f 100644
--- a/chrome/browser/apps/guest_view/app_view_browsertest.cc
+++ b/chrome/browser/apps/guest_view/extension_view_browsertest.cc
@@ -4,25 +4,18 @@
#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 {
class TestGuestViewManager : public extensions::GuestViewManager {
public:
- explicit TestGuestViewManager(content::BrowserContext* context) :
- extensions::GuestViewManager(context),
- web_contents_(NULL) {}
+ explicit TestGuestViewManager(content::BrowserContext* context)
+ : extensions::GuestViewManager(context), web_contents_(NULL) {}
content::WebContents* WaitForGuestCreated() {
if (web_contents_)
@@ -34,11 +27,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 +45,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 +69,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 +79,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.
@@ -120,8 +98,7 @@ class AppViewTest : public extensions::PlatformAppBrowserTest {
done_listener.set_failure_message("TEST_FAILED");
if (!content::ExecuteScript(
embedder_web_contents,
- base::StringPrintf("runTest('%s', '%s')",
- test_name.c_str(),
+ base::StringPrintf("runTest('%s', '%s')", test_name.c_str(),
app_to_embed.c_str()))) {
LOG(ERROR) << "UNABLE TO START TEST.";
return;
@@ -137,42 +114,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/skeleton");
+ TestHelper("testExtensionViewCreationShouldSucceed", "extension_view",
+ 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"));
}
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698