#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/apps/app_browsertest_util.h"
-#include "chrome/browser/automation/automation_util.h"
+#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/prerender/prerender_link_manager.h"
#include "chrome/browser/prerender/prerender_link_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
+#include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h"
+#include "chrome/browser/task_manager/task_manager_browsertest_util.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/common/extensions/extension.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/fake_speech_recognition_manager.h"
+#include "content/public/test/test_renderer_host.h"
+#include "extensions/browser/guest_view/guest_view_manager.h"
+#include "extensions/browser/guest_view/guest_view_manager_factory.h"
+#include "extensions/common/extension.h"
#include "extensions/common/extensions_client.h"
+#include "media/base/media_switches.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"
#include "ui/gl/gl_switches.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
+#include "chrome/browser/chromeos/accessibility/speech_monitor.h"
+#endif
+
// For fine-grained suppression on flaky tests.
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#endif
+using extensions::ContextMenuMatcher;
+using extensions::MenuItem;
using prerender::PrerenderLinkManager;
using prerender::PrerenderLinkManagerFactory;
+using task_manager::browsertest_util::MatchAboutBlankTab;
+using task_manager::browsertest_util::MatchAnyApp;
+using task_manager::browsertest_util::MatchAnyBackground;
+using task_manager::browsertest_util::MatchAnyTab;
+using task_manager::browsertest_util::MatchAnyWebView;
+using task_manager::browsertest_util::MatchApp;
+using task_manager::browsertest_util::MatchBackground;
+using task_manager::browsertest_util::MatchWebView;
+using task_manager::browsertest_util::WaitForTaskManagerRows;
+using ui::MenuModel;
namespace {
const char kEmptyResponsePath[] = "/close-socket";
virtual std::string GetHTMLContents() OVERRIDE { return std::string(); }
};
-class WebContentsCreatedListener {
+class TestGuestViewManager : public extensions::GuestViewManager {
public:
- WebContentsCreatedListener() : web_contents_(NULL) {
- content::WebContents::AddCreatedCallback(
- base::Bind(&WebContentsCreatedListener::CreatedCallback,
- base::Unretained(this)));
- }
+ explicit TestGuestViewManager(content::BrowserContext* context) :
+ GuestViewManager(context),
+ web_contents_(NULL) {}
- content::WebContents* WaitForWebContentsCreated() {
+ content::WebContents* WaitForGuestCreated() {
if (web_contents_)
return web_contents_;
}
private:
- void CreatedCallback(content::WebContents* web_contents) {
- web_contents_ = web_contents;
+ // GuestViewManager override:
+ virtual void AddGuest(int guest_instance_id,
+ content::WebContents* guest_web_contents) OVERRIDE{
+ extensions::GuestViewManager::AddGuest(
+ guest_instance_id, guest_web_contents);
+ web_contents_ = guest_web_contents;
if (message_loop_runner_)
message_loop_runner_->Quit();
}
- private:
content::WebContents* web_contents_;
scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
+};
+
+// Test factory for creating test instances of GuestViewManager.
+class TestGuestViewManagerFactory :
+ public extensions::GuestViewManagerFactory {
+ public:
+ TestGuestViewManagerFactory() :
+ test_guest_view_manager_(NULL) {}
+
+ virtual ~TestGuestViewManagerFactory() {}
- DISALLOW_COPY_AND_ASSIGN(WebContentsCreatedListener);
+ virtual extensions::GuestViewManager* CreateGuestViewManager(
+ content::BrowserContext* context) OVERRIDE {
+ return GetManager(context);
+ }
+
+ TestGuestViewManager* GetManager(content::BrowserContext* context) {
+ if (!test_guest_view_manager_) {
+ test_guest_view_manager_ = new TestGuestViewManager(context);
+ }
+ return test_guest_view_manager_;
+ }
+
+ private:
+ TestGuestViewManager* test_guest_view_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestGuestViewManagerFactory);
+};
+
+class WebContentsHiddenObserver : public content::WebContentsObserver {
+ public:
+ WebContentsHiddenObserver(content::WebContents* web_contents,
+ const base::Closure& hidden_callback)
+ : WebContentsObserver(web_contents),
+ hidden_callback_(hidden_callback),
+ hidden_observed_(false) {
+ }
+
+ // WebContentsObserver.
+ virtual void WasHidden() OVERRIDE {
+ hidden_observed_ = true;
+ hidden_callback_.Run();
+ }
+
+ bool hidden_observed() { return hidden_observed_; }
+
+ private:
+ base::Closure hidden_callback_;
+ bool hidden_observed_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebContentsHiddenObserver);
};
class InterstitialObserver : public content::WebContentsObserver {
DISALLOW_COPY_AND_ASSIGN(InterstitialObserver);
};
+void ExecuteScriptWaitForTitle(content::WebContents* web_contents,
+ const char* script,
+ const char* title) {
+ base::string16 expected_title(base::ASCIIToUTF16(title));
+ base::string16 error_title(base::ASCIIToUTF16("error"));
+
+ content::TitleWatcher title_watcher(web_contents, expected_title);
+ title_watcher.AlsoWaitForTitle(error_title);
+ EXPECT_TRUE(content::ExecuteScript(web_contents, script));
+ EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
+}
+
} // namespace
// This class intercepts media access request from the embedder. The request
virtual void CanDownload(
content::RenderViewHost* render_view_host,
- int request_id,
+ const GURL& url,
const std::string& request_method,
const base::Callback<void(bool)>& callback) OVERRIDE {
orig_delegate_->CanDownload(
- render_view_host, request_id, request_method,
+ render_view_host, url, request_method,
base::Bind(&MockDownloadWebContentsDelegate::DownloadDecided,
base::Unretained(this)));
}
content::SpeechRecognitionManager::SetManagerForTesting(
fake_speech_recognition_manager_.get());
}
-
- // We need real contexts, otherwise the embedder doesn't composite, but the
- // guest does, and that isn't an expected configuration.
- UseRealGLContexts();
extensions::PlatformAppBrowserTest::SetUp();
}
}
virtual void SetUpOnMainThread() OVERRIDE {
+ extensions::PlatformAppBrowserTest::SetUpOnMainThread();
const testing::TestInfo* const test_info =
testing::UnitTest::GetInstance()->current_test_info();
// Mock out geolocation for geolocation specific tests.
}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
- const testing::TestInfo* const test_info =
- testing::UnitTest::GetInstance()->current_test_info();
-
- // Force SW rendering to check autosize bug.
- if (!strncmp(test_info->name(), "AutoSizeSW", strlen("AutosizeSW")))
- command_line->AppendSwitch(switches::kDisableForceCompositingMode);
+ command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream);
+ command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc");
extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
}
tag_url6, content::NotificationService::AllSources());
ui_test_utils::UrlLoadObserver observer7(
tag_url7, content::NotificationService::AllSources());
- LoadAndLaunchPlatformApp("web_view/isolation");
+ LoadAndLaunchPlatformApp("web_view/isolation", "Launched");
observer1.Wait();
observer2.Wait();
observer3.Wait();
observer7.Wait();
content::Source<content::NavigationController> source1 = observer1.source();
- EXPECT_TRUE(source1->GetWebContents()->GetRenderProcessHost()->IsGuest());
+ EXPECT_TRUE(source1->GetWebContents()->GetRenderProcessHost()->
+ IsIsolatedGuest());
content::Source<content::NavigationController> source2 = observer2.source();
- EXPECT_TRUE(source2->GetWebContents()->GetRenderProcessHost()->IsGuest());
+ EXPECT_TRUE(source2->GetWebContents()->GetRenderProcessHost()->
+ IsIsolatedGuest());
content::Source<content::NavigationController> source3 = observer3.source();
- EXPECT_TRUE(source3->GetWebContents()->GetRenderProcessHost()->IsGuest());
+ EXPECT_TRUE(source3->GetWebContents()->GetRenderProcessHost()->
+ IsIsolatedGuest());
content::Source<content::NavigationController> source4 = observer4.source();
- EXPECT_TRUE(source4->GetWebContents()->GetRenderProcessHost()->IsGuest());
+ EXPECT_TRUE(source4->GetWebContents()->GetRenderProcessHost()->
+ IsIsolatedGuest());
content::Source<content::NavigationController> source5 = observer5.source();
- EXPECT_TRUE(source5->GetWebContents()->GetRenderProcessHost()->IsGuest());
+ EXPECT_TRUE(source5->GetWebContents()->GetRenderProcessHost()->
+ IsIsolatedGuest());
content::Source<content::NavigationController> source6 = observer6.source();
- EXPECT_TRUE(source6->GetWebContents()->GetRenderProcessHost()->IsGuest());
+ EXPECT_TRUE(source6->GetWebContents()->GetRenderProcessHost()->
+ IsIsolatedGuest());
content::Source<content::NavigationController> source7 = observer7.source();
- EXPECT_TRUE(source7->GetWebContents()->GetRenderProcessHost()->IsGuest());
+ EXPECT_TRUE(source7->GetWebContents()->GetRenderProcessHost()->
+ IsIsolatedGuest());
// Check that the first two tags use the same process and it is different
// than the process used by the other two.
}
}
- void ExecuteScriptWaitForTitle(content::WebContents* web_contents,
- const char* script,
- const char* title) {
- string16 expected_title(ASCIIToUTF16(title));
- string16 error_title(ASCIIToUTF16("error"));
-
- content::TitleWatcher title_watcher(web_contents, expected_title);
- title_watcher.AlsoWaitForTitle(error_title);
- EXPECT_TRUE(content::ExecuteScript(web_contents, script));
- EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
- }
-
// Handles |request| by serving a redirect response.
static scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler(
const std::string& path,
return scoped_ptr<net::test_server::HttpResponse>();
}
+ // Shortcut to return the current MenuManager.
+ extensions::MenuManager* menu_manager() {
+ return extensions::MenuManager::Get(browser()->profile());
+ }
+
+ // This gets all the items that any extension has registered for possible
+ // inclusion in context menus.
+ MenuItem::List GetItems() {
+ MenuItem::List result;
+ std::set<MenuItem::ExtensionKey> extension_ids =
+ menu_manager()->ExtensionIds();
+ std::set<MenuItem::ExtensionKey>::iterator i;
+ for (i = extension_ids.begin(); i != extension_ids.end(); ++i) {
+ const MenuItem::List* list = menu_manager()->MenuItems(*i);
+ result.insert(result.end(), list->begin(), list->end());
+ }
+ return result;
+ }
+
+ enum TestServer {
+ NEEDS_TEST_SERVER,
+ NO_TEST_SERVER
+ };
+
void TestHelper(const std::string& test_name,
- const std::string& test_passed_msg,
- const std::string& test_failed_msg,
- const std::string& app_location) {
- ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp(app_location.c_str());
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ const std::string& app_location,
+ TestServer test_server) {
+ // For serving guest pages.
+ if (test_server == NEEDS_TEST_SERVER) {
+ if (!StartEmbeddedTestServer()) {
+ LOG(ERROR) << "FAILED TO START TEST SERVER.";
+ return;
+ }
+ embedded_test_server()->RegisterRequestHandler(
+ base::Bind(&WebViewTest::RedirectResponseHandler,
+ kRedirectResponsePath,
+ embedded_test_server()->GetURL(kRedirectResponseFullPath)));
+
+ embedded_test_server()->RegisterRequestHandler(
+ base::Bind(&WebViewTest::EmptyResponseHandler, kEmptyResponsePath));
+ }
- embedded_test_server()->RegisterRequestHandler(
- base::Bind(&WebViewTest::RedirectResponseHandler,
- kRedirectResponsePath,
- embedded_test_server()->GetURL(kRedirectResponseFullPath)));
+ LoadAndLaunchPlatformApp(app_location.c_str(), "Launched");
- embedded_test_server()->RegisterRequestHandler(
- base::Bind(&WebViewTest::EmptyResponseHandler, kEmptyResponsePath));
+ // Flush any pending events to make sure we start with a clean slate.
+ content::RunAllPendingInMessageLoop();
content::WebContents* embedder_web_contents =
- GetFirstShellWindowWebContents();
- ASSERT_TRUE(embedder_web_contents);
+ GetFirstAppWindowWebContents();
+ if (!embedder_web_contents) {
+ LOG(ERROR) << "UNABLE TO FIND EMBEDDER WEB CONTENTS.";
+ return;
+ }
- ExtensionTestMessageListener done_listener(test_passed_msg, false);
- done_listener.AlsoListenForFailureMessage(test_failed_msg);
- EXPECT_TRUE(content::ExecuteScript(
- embedder_web_contents,
- base::StringPrintf("runTest('%s')", test_name.c_str())));
+ ExtensionTestMessageListener done_listener("TEST_PASSED", false);
+ done_listener.set_failure_message("TEST_FAILED");
+ if (!content::ExecuteScript(
+ embedder_web_contents,
+ base::StringPrintf("runTest('%s')", test_name.c_str()))) {
+ LOG(ERROR) << "UNABLE TO START TEST.";
+ return;
+ }
ASSERT_TRUE(done_listener.WaitUntilSatisfied());
}
ui_test_utils::UrlLoadObserver guest_observer(
guest_url, content::NotificationService::AllSources());
- ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false);
- LoadAndLaunchPlatformApp(app_path.c_str());
- guest_observer.Wait();
+ LoadAndLaunchPlatformApp(app_path.c_str(), "guest-loaded");
+ guest_observer.Wait();
content::Source<content::NavigationController> source =
guest_observer.source();
- EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->IsGuest());
-
- bool satisfied = guest_loaded_listener.WaitUntilSatisfied();
- if (!satisfied)
- return NULL;
+ EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->
+ IsIsolatedGuest());
content::WebContents* guest_web_contents = source->GetWebContents();
return guest_web_contents;
// they timeout (mostly on Windows).
void MediaAccessAPIDenyTestHelper(const std::string& test_name) {
ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
- ExtensionTestMessageListener loaded_listener("loaded", false);
- LoadAndLaunchPlatformApp("web_view/media_access/deny");
- ASSERT_TRUE(loaded_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/media_access/deny", "loaded");
content::WebContents* embedder_web_contents =
- GetFirstShellWindowWebContents();
+ GetFirstAppWindowWebContents();
ASSERT_TRUE(embedder_web_contents);
ExtensionTestMessageListener test_run_listener("PASSED", false);
- test_run_listener.AlsoListenForFailureMessage("FAILED");
+ test_run_listener.set_failure_message("FAILED");
EXPECT_TRUE(
content::ExecuteScript(
embedder_web_contents,
loop_runner->Run();
}
+ void LoadAppWithGuest(const std::string& app_path) {
+
+ ExtensionTestMessageListener launched_listener("WebViewTest.LAUNCHED",
+ false);
+ launched_listener.set_failure_message("WebViewTest.FAILURE");
+ LoadAndLaunchPlatformApp(app_path.c_str(), &launched_listener);
+
+ guest_web_contents_ = GetGuestViewManager()->WaitForGuestCreated();
+ }
+
+ void SendMessageToEmbedder(const std::string& message) {
+ EXPECT_TRUE(
+ content::ExecuteScript(
+ GetEmbedderWebContents(),
+ base::StringPrintf("onAppCommand('%s');", message.c_str())));
+ }
+
+ void SendMessageToGuestAndWait(const std::string& message,
+ const std::string& wait_message) {
+ scoped_ptr<ExtensionTestMessageListener> listener;
+ if (!wait_message.empty()) {
+ listener.reset(new ExtensionTestMessageListener(wait_message, false));
+ }
+
+ EXPECT_TRUE(
+ content::ExecuteScript(
+ GetGuestWebContents(),
+ base::StringPrintf("onAppCommand('%s');", message.c_str())));
+
+ if (listener) {
+ ASSERT_TRUE(listener->WaitUntilSatisfied());
+ }
+ }
+
+ content::WebContents* GetGuestWebContents() {
+ return guest_web_contents_;
+ }
+
+ content::WebContents* GetEmbedderWebContents() {
+ if (!embedder_web_contents_) {
+ embedder_web_contents_ = GetFirstAppWindowWebContents();
+ }
+ return embedder_web_contents_;
+ }
+
+ TestGuestViewManager* GetGuestViewManager() {
+ return factory_.GetManager(browser()->profile());
+ }
+
+ WebViewTest() : guest_web_contents_(NULL),
+ embedder_web_contents_(NULL) {
+ extensions::GuestViewManager::set_factory_for_testing(&factory_);
+ }
+
private:
bool UsesFakeSpeech() {
const testing::TestInfo* const test_info =
testing::UnitTest::GetInstance()->current_test_info();
// SpeechRecognition test specific SetUp.
- return !strcmp(test_info->name(), "SpeechRecognition") ||
- !strcmp(test_info->name(),
+ return !strcmp(test_info->name(),
"SpeechRecognitionAPI_HasPermissionAllow");
}
scoped_ptr<content::FakeSpeechRecognitionManager>
fake_speech_recognition_manager_;
+
+ TestGuestViewManagerFactory factory_;
+ // Note that these are only set if you launch app using LoadAppWithGuest().
+ content::WebContents* guest_web_contents_;
+ content::WebContents* embedder_web_contents_;
};
+// This test verifies that hiding the guest triggers WebContents::WasHidden().
+IN_PROC_BROWSER_TEST_F(WebViewTest, GuestVisibilityChanged) {
+ LoadAppWithGuest("web_view/visibility_changed");
+
+ scoped_refptr<content::MessageLoopRunner> loop_runner(
+ new content::MessageLoopRunner);
+ WebContentsHiddenObserver observer(GetGuestWebContents(),
+ loop_runner->QuitClosure());
+
+ // Handled in platform_apps/web_view/visibility_changed/main.js
+ SendMessageToEmbedder("hide-guest");
+ if (!observer.hidden_observed())
+ loop_runner->Run();
+}
+
+// This test verifies that hiding the embedder also hides the guest.
+IN_PROC_BROWSER_TEST_F(WebViewTest, EmbedderVisibilityChanged) {
+ LoadAppWithGuest("web_view/visibility_changed");
+
+ scoped_refptr<content::MessageLoopRunner> loop_runner(
+ new content::MessageLoopRunner);
+ WebContentsHiddenObserver observer(GetGuestWebContents(),
+ loop_runner->QuitClosure());
+
+ // Handled in platform_apps/web_view/visibility_changed/main.js
+ SendMessageToEmbedder("hide-embedder");
+ if (!observer.hidden_observed())
+ loop_runner->Run();
+}
+
+// This test verifies that reloading the embedder reloads the guest (and doest
+// not crash).
+IN_PROC_BROWSER_TEST_F(WebViewTest, ReloadEmbedder) {
+ // Just load a guest from other test, we do not want to add a separate
+ // platform_app for this test.
+ LoadAppWithGuest("web_view/visibility_changed");
+
+ ExtensionTestMessageListener launched_again_listener("WebViewTest.LAUNCHED",
+ false);
+ GetEmbedderWebContents()->GetController().Reload(false);
+ ASSERT_TRUE(launched_again_listener.WaitUntilSatisfied());
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, AcceptTouchEvents) {
+ LoadAppWithGuest("web_view/accept_touch_events");
+
+ content::RenderViewHost* embedder_rvh =
+ GetEmbedderWebContents()->GetRenderViewHost();
+
+ bool embedder_has_touch_handler =
+ content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh);
+ EXPECT_FALSE(embedder_has_touch_handler);
+
+ SendMessageToGuestAndWait("install-touch-handler", "installed-touch-handler");
+
+ // Note that we need to wait for the installed/registered touch handler to
+ // appear in browser process before querying |embedder_rvh|.
+ // In practice, since we do a roundrtip from browser process to guest and
+ // back, this is sufficient.
+ embedder_has_touch_handler =
+ content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh);
+ EXPECT_TRUE(embedder_has_touch_handler);
+
+ SendMessageToGuestAndWait("uninstall-touch-handler",
+ "uninstalled-touch-handler");
+ // Same as the note above about waiting.
+ embedder_has_touch_handler =
+ content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh);
+ EXPECT_FALSE(embedder_has_touch_handler);
+}
+
// This test ensures JavaScript errors ("Cannot redefine property") do not
// happen when a <webview> is removed from DOM and added back.
IN_PROC_BROWSER_TEST_F(WebViewTest,
<< message_;
}
-#if !defined(OS_CHROMEOS)
-// This test ensures <webview> doesn't crash in SW rendering when autosize is
-// turned on.
-IN_PROC_BROWSER_TEST_F(WebViewTest, AutoSizeSW) {
-#if defined(OS_WIN)
- // Flaky on XP bot http://crbug.com/299507
- if (base::win::GetVersion() <= base::win::VERSION_XP)
- return;
-#endif
- ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/autosize"))
- << message_;
-}
-#endif
-
-IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeAfterNavigation) {
- TestHelper("testAutosizeAfterNavigation",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+// http://crbug.com/326332
+IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_Shim_TestAutosizeAfterNavigation) {
+ TestHelper("testAutosizeAfterNavigation", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) {
- TestHelper("testAutosizeBeforeNavigation",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testAutosizeBeforeNavigation", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeRemoveAttributes) {
- TestHelper("testAutosizeRemoveAttributes",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testAutosizeRemoveAttributes", "web_view/shim", NO_TEST_SERVER);
}
// This test is disabled due to being flaky. http://crbug.com/282116
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_MACOSX)
#define MAYBE_Shim_TestAutosizeWithPartialAttributes \
DISABLED_Shim_TestAutosizeWithPartialAttributes
#else
IN_PROC_BROWSER_TEST_F(WebViewTest,
MAYBE_Shim_TestAutosizeWithPartialAttributes) {
TestHelper("testAutosizeWithPartialAttributes",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAPIMethodExistence) {
- TestHelper("testAPIMethodExistence",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testAPIMethodExistence", "web_view/shim", NO_TEST_SERVER);
}
// Tests the existence of WebRequest API event objects on the request
// object, on the webview element, and hanging directly off webview.
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIExistence) {
- TestHelper("testWebRequestAPIExistence",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testWebRequestAPIExistence", "web_view/shim", NO_TEST_SERVER);
}
-IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestChromeExtensionURL) {
- TestHelper("testChromeExtensionURL",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+// http://crbug.com/315920
+#if defined(GOOGLE_CHROME_BUILD) && (defined(OS_WIN) || defined(OS_LINUX))
+#define MAYBE_Shim_TestChromeExtensionURL DISABLED_Shim_TestChromeExtensionURL
+#else
+#define MAYBE_Shim_TestChromeExtensionURL Shim_TestChromeExtensionURL
+#endif
+IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_Shim_TestChromeExtensionURL) {
+ TestHelper("testChromeExtensionURL", "web_view/shim", NO_TEST_SERVER);
}
-IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestChromeExtensionRelativePath) {
+// http://crbug.com/315920
+#if defined(GOOGLE_CHROME_BUILD) && (defined(OS_WIN) || defined(OS_LINUX))
+#define MAYBE_Shim_TestChromeExtensionRelativePath \
+ DISABLED_Shim_TestChromeExtensionRelativePath
+#else
+#define MAYBE_Shim_TestChromeExtensionRelativePath \
+ Shim_TestChromeExtensionRelativePath
+#endif
+IN_PROC_BROWSER_TEST_F(WebViewTest,
+ MAYBE_Shim_TestChromeExtensionRelativePath) {
TestHelper("testChromeExtensionRelativePath",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NO_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestDisplayNoneWebviewLoad) {
+ TestHelper("testDisplayNoneWebviewLoad", "web_view/shim", NO_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestDisplayNoneWebviewRemoveChild) {
+ TestHelper("testDisplayNoneWebviewRemoveChild",
+ "web_view/shim", NO_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest,
+ Shim_TestInlineScriptFromAccessibleResources) {
+ TestHelper("testInlineScriptFromAccessibleResources",
+ "web_view/shim",
+ NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestInvalidChromeExtensionURL) {
- TestHelper("testInvalidChromeExtensionURL",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testInvalidChromeExtensionURL", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestEventName) {
- TestHelper("testEventName",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testEventName", "web_view/shim", NO_TEST_SERVER);
}
-IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestOnEventProperty) {
- TestHelper("testOnEventProperties",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+// WebViewTest.Shim_TestOnEventProperty is flaky, so disable it.
+// http://crbug.com/359832.
+IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_Shim_TestOnEventProperty) {
+ TestHelper("testOnEventProperties", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadProgressEvent) {
- TestHelper("testLoadProgressEvent",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testLoadProgressEvent", "web_view/shim", NO_TEST_SERVER);
}
-// WebViewTest.Shim_TestDestroyOnEventListener is flaky, so disable it.
-// http://crbug.com/255106
-IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_Shim_TestDestroyOnEventListener) {
- TestHelper("testDestroyOnEventListener",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestDestroyOnEventListener) {
+ TestHelper("testDestroyOnEventListener", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestCannotMutateEventName) {
- TestHelper("testCannotMutateEventName",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testCannotMutateEventName", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestPartitionRaisesException) {
-#if defined(OS_WIN)
- // Flaky on XP bot http://crbug.com/267304
- if (base::win::GetVersion() <= base::win::VERSION_XP)
- return;
-#endif
+ TestHelper("testPartitionRaisesException", "web_view/shim", NO_TEST_SERVER);
+}
- TestHelper("testPartitionRaisesException",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+IN_PROC_BROWSER_TEST_F(WebViewTest,
+ Shim_TestPartitionRemovalAfterNavigationFails) {
+ TestHelper("testPartitionRemovalAfterNavigationFails",
+ "web_view/shim",
+ NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestExecuteScriptFail) {
return;
#endif
- TestHelper("testExecuteScriptFail",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testExecuteScriptFail", "web_view/shim", NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestExecuteScript) {
- TestHelper("testExecuteScript",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testExecuteScript", "web_view/shim", NO_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(
+ WebViewTest,
+ Shim_TestExecuteScriptIsAbortedWhenWebViewSourceIsChanged) {
+ TestHelper("testExecuteScriptIsAbortedWhenWebViewSourceIsChanged",
+ "web_view/shim",
+ NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestTerminateAfterExit) {
- TestHelper("testTerminateAfterExit",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testTerminateAfterExit", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAssignSrcAfterCrash) {
- TestHelper("testAssignSrcAfterCrash",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testAssignSrcAfterCrash", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest,
Shim_TestNavOnConsecutiveSrcAttributeChanges) {
TestHelper("testNavOnConsecutiveSrcAttributeChanges",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNavOnSrcAttributeChange) {
- TestHelper("testNavOnSrcAttributeChange",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testNavOnSrcAttributeChange", "web_view/shim", NO_TEST_SERVER);
}
-IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveSrcAttribute) {
- TestHelper("testRemoveSrcAttribute",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNavigateAfterResize) {
+ TestHelper("testNavigateAfterResize", "web_view/shim", NO_TEST_SERVER);
}
-IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestReassignSrcAttribute) {
- TestHelper("testReassignSrcAttribute",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveSrcAttribute) {
+ TestHelper("testRemoveSrcAttribute", "web_view/shim", NO_TEST_SERVER);
}
-IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestBrowserPluginNotAllowed) {
-#if defined(OS_WIN)
- // Flaky on XP bots. http://crbug.com/267300
- if (base::win::GetVersion() <= base::win::VERSION_XP)
- return;
-#endif
-
- TestHelper("testBrowserPluginNotAllowed",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestReassignSrcAttribute) {
+ TestHelper("testReassignSrcAttribute", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNewWindow) {
- TestHelper("testNewWindow",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testNewWindow", "web_view/shim", NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNewWindowTwoListeners) {
- TestHelper("testNewWindowTwoListeners",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testNewWindowTwoListeners", "web_view/shim", NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNewWindowNoPreventDefault) {
TestHelper("testNewWindowNoPreventDefault",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNewWindowNoReferrerLink) {
- TestHelper("testNewWindowNoReferrerLink",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testNewWindowNoReferrerLink", "web_view/shim", NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestContentLoadEvent) {
- TestHelper("testContentLoadEvent",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testContentLoadEvent", "web_view/shim", NO_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestDeclarativeWebRequestAPI) {
+ TestHelper("testDeclarativeWebRequestAPI",
+ "web_view/shim",
+ NEEDS_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest,
+ Shim_TestDeclarativeWebRequestAPISendMessage) {
+ TestHelper("testDeclarativeWebRequestAPISendMessage",
+ "web_view/shim",
+ NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPI) {
- TestHelper("testWebRequestAPI",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testWebRequestAPI", "web_view/shim", NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIGoogleProperty) {
TestHelper("testWebRequestAPIGoogleProperty",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NO_TEST_SERVER);
}
// This test is disabled due to being flaky. http://crbug.com/309451
WebViewTest,
MAYBE_Shim_TestWebRequestListenerSurvivesReparenting) {
TestHelper("testWebRequestListenerSurvivesReparenting",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadStartLoadRedirect) {
- TestHelper("testLoadStartLoadRedirect",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testLoadStartLoadRedirect", "web_view/shim", NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest,
Shim_TestLoadAbortChromeExtensionURLWrongPartition) {
TestHelper("testLoadAbortChromeExtensionURLWrongPartition",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortEmptyResponse) {
- TestHelper("testLoadAbortEmptyResponse",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testLoadAbortEmptyResponse", "web_view/shim", NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortIllegalChromeURL) {
TestHelper("testLoadAbortIllegalChromeURL",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortIllegalFileURL) {
- TestHelper("testLoadAbortIllegalFileURL",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testLoadAbortIllegalFileURL", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortIllegalJavaScriptURL) {
TestHelper("testLoadAbortIllegalJavaScriptURL",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NO_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortInvalidNavigation) {
+ TestHelper("testLoadAbortInvalidNavigation", "web_view/shim", NO_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortNonWebSafeScheme) {
+ TestHelper("testLoadAbortNonWebSafeScheme", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestReload) {
- TestHelper("testReload",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testReload", "web_view/shim", NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestGetProcessId) {
- TestHelper("testGetProcessId",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testGetProcessId", "web_view/shim", NEEDS_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestHiddenBeforeNavigation) {
+ TestHelper("testHiddenBeforeNavigation", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewOnExit) {
ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
// Launch the app and wait until it's ready to load a test.
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp("web_view/shim");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/shim", "Launched");
- content::WebContents* embedder_web_contents =
- GetFirstShellWindowWebContents();
+ content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(embedder_web_contents);
GURL::Replacements replace_host;
content::Source<content::NavigationController> source =
guest_observer.source();
- EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->IsGuest());
+ EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->
+ IsIsolatedGuest());
ASSERT_TRUE(guest_loaded_listener.WaitUntilSatisfied());
// This is a regression test for http://crbug.com/276023.
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewAfterNavigation) {
TestHelper("testRemoveWebviewAfterNavigation",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNavigationToExternalProtocol) {
TestHelper("testNavigationToExternalProtocol",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestResizeWebviewResizesContent) {
TestHelper("testResizeWebviewResizesContent",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ "web_view/shim",
+ NO_TEST_SERVER);
}
// This test makes sure we do not crash if app is closed while interstitial
// page is being shown in guest.
-// Test flaky on windows; http://crbug.com/297014 .
-#if defined(OS_WIN)
+// Disabled under LeakSanitizer due to memory leaks. http://crbug.com/321662
+#if defined(LEAK_SANITIZER)
#define MAYBE_InterstitialTeardown DISABLED_InterstitialTeardown
#else
#define MAYBE_InterstitialTeardown InterstitialTeardown
#endif
IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_InterstitialTeardown) {
+#if defined(OS_WIN)
+ // Flaky on XP bot http://crbug.com/297014
+ if (base::win::GetVersion() <= base::win::VERSION_XP)
+ return;
+#endif
+
// Start a HTTPS server so we can load an interstitial page inside guest.
net::SpawnedTestServer::SSLOptions ssl_options;
ssl_options.server_certificate =
net::HostPortPair host_and_port = https_server.host_port_pair();
- ExtensionTestMessageListener embedder_loaded_listener("EmbedderLoaded",
- false);
- LoadAndLaunchPlatformApp("web_view/interstitial_teardown");
- ASSERT_TRUE(embedder_loaded_listener.WaitUntilSatisfied());
-
- WebContentsCreatedListener web_contents_created_listener;
+ LoadAndLaunchPlatformApp("web_view/interstitial_teardown", "EmbedderLoaded");
// Now load the guest.
- content::WebContents* embedder_web_contents =
- GetFirstShellWindowWebContents();
+ content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents();
ExtensionTestMessageListener second("GuestAddedToDom", false);
EXPECT_TRUE(content::ExecuteScript(
embedder_web_contents,
// Wait for interstitial page to be shown in guest.
content::WebContents* guest_web_contents =
- web_contents_created_listener.WaitForWebContentsCreated();
- ASSERT_TRUE(guest_web_contents->GetRenderProcessHost()->IsGuest());
+ GetGuestViewManager()->WaitForGuestCreated();
+ ASSERT_TRUE(guest_web_contents->GetRenderProcessHost()->IsIsolatedGuest());
WaitForInterstitial(guest_web_contents);
// Now close the app while interstitial page being shown in guest.
- apps::ShellWindow* window = GetFirstShellWindow();
+ apps::AppWindow* window = GetFirstAppWindow();
window->GetBaseWindow()->Close();
}
<< message_;
}
-IN_PROC_BROWSER_TEST_F(WebViewTest, Size) {
- ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/size")) << message_;
-}
-
// This test verifies that prerendering has been disabled inside <webview>.
// This test is here rather than in PrerenderBrowserTest for testing convenience
// only. If it breaks then this is a bug in the prerenderer.
EXPECT_TRUE(prerender_link_manager->IsEmpty());
}
+// Verify that existing <webview>'s are detected when the task manager starts
+// up.
+IN_PROC_BROWSER_TEST_F(WebViewTest, TaskManagerExistingWebView) {
+ ASSERT_TRUE(StartEmbeddedTestServer());
+
+ LoadGuest("/extensions/platform_apps/web_view/task_manager/guest.html",
+ "web_view/task_manager");
+
+ chrome::ShowTaskManager(browser()); // Show task manager AFTER guest loads.
+
+ const char* guest_title = "WebViewed test content";
+ const char* app_name = "<webview> task manager test";
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchWebView(guest_title)));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchApp(app_name)));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchBackground(app_name)));
+
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyWebView()));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyApp()));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyBackground()));
+}
+
+// Verify that the task manager notices the creation of new <webview>'s.
+IN_PROC_BROWSER_TEST_F(WebViewTest, TaskManagerNewWebView) {
+ ASSERT_TRUE(StartEmbeddedTestServer());
+
+ chrome::ShowTaskManager(browser()); // Show task manager BEFORE guest loads.
+
+ LoadGuest("/extensions/platform_apps/web_view/task_manager/guest.html",
+ "web_view/task_manager");
+
+ const char* guest_title = "WebViewed test content";
+ const char* app_name = "<webview> task manager test";
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchWebView(guest_title)));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchApp(app_name)));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchBackground(app_name)));
+
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyWebView()));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyApp()));
+ ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyBackground()));
+}
+
// This tests cookie isolation for packaged apps with webview tags. It navigates
// the main browser window to a page that sets a cookie and loads an app with
// multiple webview tags. Each tag sets a cookie and the test checks the proper
// storage isolation is enforced.
-// This test is disabled due to being flaky. http://crbug.com/294196
-#if defined(OS_WIN)
-#define MAYBE_CookieIsolation DISABLED_CookieIsolation
-#else
-#define MAYBE_CookieIsolation CookieIsolation
-#endif
-IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_CookieIsolation) {
+IN_PROC_BROWSER_TEST_F(WebViewTest, CookieIsolation) {
ASSERT_TRUE(StartEmbeddedTestServer());
const std::string kExpire =
"var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);";
std::string cookie_value;
// Test the regular browser context to ensure we have only one cookie.
- automation_util::GetCookies(GURL("http://localhost"),
- browser()->tab_strip_model()->GetWebContentsAt(0),
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ browser()->tab_strip_model()->GetWebContentsAt(0),
+ &cookie_size, &cookie_value);
EXPECT_EQ("testCookie=1", cookie_value);
// The default behavior is to combine webview tags with no explicit partition
// declaration into the same in-memory partition. Test the webview tags to
// ensure we have properly set the cookies and we have both cookies in both
// tags.
- automation_util::GetCookies(GURL("http://localhost"),
- cookie_contents1,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ cookie_contents1,
+ &cookie_size, &cookie_value);
EXPECT_EQ("guest1=true; guest2=true", cookie_value);
- automation_util::GetCookies(GURL("http://localhost"),
- cookie_contents2,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ cookie_contents2,
+ &cookie_size, &cookie_value);
EXPECT_EQ("guest1=true; guest2=true", cookie_value);
// The third tag should not have any cookies as it is in a separate partition.
- automation_util::GetCookies(GURL("http://localhost"),
- named_partition_contents1,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ named_partition_contents1,
+ &cookie_size, &cookie_value);
EXPECT_EQ("", cookie_value);
}
std::string cookie_value;
// Check that all in-memory partitions have a cookie set.
- automation_util::GetCookies(GURL("http://localhost"),
- cookie_contents1,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ cookie_contents1,
+ &cookie_size, &cookie_value);
EXPECT_EQ("inmemory=true", cookie_value);
- automation_util::GetCookies(GURL("http://localhost"),
- cookie_contents2,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ cookie_contents2,
+ &cookie_size, &cookie_value);
EXPECT_EQ("inmemory=true", cookie_value);
- automation_util::GetCookies(GURL("http://localhost"),
- named_partition_contents1,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ named_partition_contents1,
+ &cookie_size, &cookie_value);
EXPECT_EQ("inmemory=true", cookie_value);
- automation_util::GetCookies(GURL("http://localhost"),
- named_partition_contents2,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ named_partition_contents2,
+ &cookie_size, &cookie_value);
EXPECT_EQ("inmemory=true", cookie_value);
// Check that all persistent partitions kept their state.
- automation_util::GetCookies(GURL("http://localhost"),
- persistent_partition_contents1,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ persistent_partition_contents1,
+ &cookie_size, &cookie_value);
EXPECT_EQ("persist1=true", cookie_value);
- automation_util::GetCookies(GURL("http://localhost"),
- persistent_partition_contents2,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ persistent_partition_contents2,
+ &cookie_size, &cookie_value);
EXPECT_EQ("persist1=true", cookie_value);
- automation_util::GetCookies(GURL("http://localhost"),
- persistent_partition_contents3,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ persistent_partition_contents3,
+ &cookie_size, &cookie_value);
EXPECT_EQ("persist2=true", cookie_value);
}
// This is the post-reset portion of the StoragePersistence test. See
// PRE_StoragePersistence for main comment.
-IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_StoragePersistence) {
+#if defined(OS_CHROMEOS)
+// http://crbug.com/223888
+#define MAYBE_StoragePersistence DISABLED_StoragePersistence
+#else
+#define MAYBE_StoragePersistence StoragePersistence
+#endif
+IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_StoragePersistence) {
ASSERT_TRUE(StartEmbeddedTestServer());
// We don't care where the main browser is on this test.
std::string cookie_value;
// Check that all in-memory partitions lost their state.
- automation_util::GetCookies(GURL("http://localhost"),
- cookie_contents1,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ cookie_contents1,
+ &cookie_size, &cookie_value);
EXPECT_EQ("", cookie_value);
- automation_util::GetCookies(GURL("http://localhost"),
- cookie_contents2,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ cookie_contents2,
+ &cookie_size, &cookie_value);
EXPECT_EQ("", cookie_value);
- automation_util::GetCookies(GURL("http://localhost"),
- named_partition_contents1,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ named_partition_contents1,
+ &cookie_size, &cookie_value);
EXPECT_EQ("", cookie_value);
- automation_util::GetCookies(GURL("http://localhost"),
- named_partition_contents2,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ named_partition_contents2,
+ &cookie_size, &cookie_value);
EXPECT_EQ("", cookie_value);
// Check that all persistent partitions kept their state.
- automation_util::GetCookies(GURL("http://localhost"),
- persistent_partition_contents1,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ persistent_partition_contents1,
+ &cookie_size, &cookie_value);
EXPECT_EQ("persist1=true", cookie_value);
- automation_util::GetCookies(GURL("http://localhost"),
- persistent_partition_contents2,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ persistent_partition_contents2,
+ &cookie_size, &cookie_value);
EXPECT_EQ("persist1=true", cookie_value);
- automation_util::GetCookies(GURL("http://localhost"),
- persistent_partition_contents3,
- &cookie_size, &cookie_value);
+ ui_test_utils::GetCookies(GURL("http://localhost"),
+ persistent_partition_contents3,
+ &cookie_size, &cookie_value);
EXPECT_EQ("persist2=true", cookie_value);
}
-#if defined(OS_WIN)
-// This test is very flaky on Win Aura, Win XP, Win 7. http://crbug.com/248873
-#define MAYBE_DOMStorageIsolation DISABLED_DOMStorageIsolation
-#else
-#define MAYBE_DOMStorageIsolation DOMStorageIsolation
-#endif
-
// This tests DOM storage isolation for packaged apps with webview tags. It
// loads an app with multiple webview tags and each tag sets DOM storage
// entries, which the test checks to ensure proper storage isolation is
// enforced.
-IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_DOMStorageIsolation) {
+IN_PROC_BROWSER_TEST_F(WebViewTest, DOMStorageIsolation) {
ASSERT_TRUE(StartEmbeddedTestServer());
GURL regular_url = embedded_test_server()->GetURL("/title1.html");
EXPECT_STREQ("badval", output.c_str());
}
-// See crbug.com/248500
-#if defined(OS_WIN)
-#define MAYBE_IndexedDBIsolation DISABLED_IndexedDBIsolation
-#else
-#define MAYBE_IndexedDBIsolation IndexedDBIsolation
-#endif
-
// This tests IndexedDB isolation for packaged apps with webview tags. It loads
// an app with multiple webview tags and each tag creates an IndexedDB record,
// which the test checks to ensure proper storage isolation is enforced.
-IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_IndexedDBIsolation) {
+IN_PROC_BROWSER_TEST_F(WebViewTest, IndexedDBIsolation) {
ASSERT_TRUE(StartEmbeddedTestServer());
GURL regular_url = embedded_test_server()->GetURL("/title1.html");
#define MAYBE_CloseOnLoadcommit CloseOnLoadcommit
#endif
IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_CloseOnLoadcommit) {
- ExtensionTestMessageListener done_test_listener(
- "done-close-on-loadcommit", false);
- LoadAndLaunchPlatformApp("web_view/close_on_loadcommit");
- ASSERT_TRUE(done_test_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/close_on_loadcommit",
+ "done-close-on-loadcommit");
}
IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIDeny_TestDeny) {
void WebViewTest::MediaAccessAPIAllowTestHelper(const std::string& test_name) {
ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp("web_view/media_access/allow");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/media_access/allow", "Launched");
- content::WebContents* embedder_web_contents =
- GetFirstShellWindowWebContents();
+ content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(embedder_web_contents);
- MockWebContentsDelegate* mock = new MockWebContentsDelegate;
- embedder_web_contents->SetDelegate(mock);
+ scoped_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
+ embedder_web_contents->SetDelegate(mock.get());
- ExtensionTestMessageListener done_listener("DoneMediaTest.PASSED", false);
- done_listener.AlsoListenForFailureMessage("DoneMediaTest.FAILED");
+ ExtensionTestMessageListener done_listener("TEST_PASSED", false);
+ done_listener.set_failure_message("TEST_FAILED");
EXPECT_TRUE(
content::ExecuteScript(
embedder_web_contents,
mock->WaitForSetMediaPermission();
}
+IN_PROC_BROWSER_TEST_F(WebViewTest, ContextMenusAPI_Basic) {
+ LoadAppWithGuest("web_view/context_menus/basic");
+
+ content::WebContents* guest_web_contents = GetGuestWebContents();
+ content::WebContents* embedder = GetEmbedderWebContents();
+ ASSERT_TRUE(embedder);
+
+ // 1. Basic property test.
+ ExecuteScriptWaitForTitle(embedder, "checkProperties()", "ITEM_CHECKED");
+
+ // 2. Create a menu item and wait for created callback to be called.
+ ExecuteScriptWaitForTitle(embedder, "createMenuItem()", "ITEM_CREATED");
+
+ // 3. Click the created item, wait for the click handlers to fire from JS.
+ ExtensionTestMessageListener click_listener("ITEM_CLICKED", false);
+ GURL page_url("http://www.google.com");
+ // Create and build our test context menu.
+ scoped_ptr<TestRenderViewContextMenu> menu(TestRenderViewContextMenu::Create(
+ guest_web_contents, page_url, GURL(), GURL()));
+
+ // Look for the extension item in the menu, and execute it.
+ int command_id = ContextMenuMatcher::ConvertToExtensionsCustomCommandId(0);
+ ASSERT_TRUE(menu->IsCommandIdEnabled(command_id));
+ menu->ExecuteCommand(command_id, 0);
+
+ // Wait for embedder's script to tell us its onclick fired, it does
+ // chrome.test.sendMessage('ITEM_CLICKED')
+ ASSERT_TRUE(click_listener.WaitUntilSatisfied());
+
+ // 4. Update the item's title and verify.
+ ExecuteScriptWaitForTitle(embedder, "updateMenuItem()", "ITEM_UPDATED");
+ MenuItem::List items = GetItems();
+ ASSERT_EQ(1u, items.size());
+ MenuItem* item = items.at(0);
+ EXPECT_EQ("new_title", item->title());
+
+ // 5. Remove the item.
+ ExecuteScriptWaitForTitle(embedder, "removeItem()", "ITEM_REMOVED");
+ MenuItem::List items_after_removal = GetItems();
+ ASSERT_EQ(0u, items_after_removal.size());
+
+ // 6. Add some more items.
+ ExecuteScriptWaitForTitle(
+ embedder, "createThreeMenuItems()", "ITEM_MULTIPLE_CREATED");
+ MenuItem::List items_after_insertion = GetItems();
+ ASSERT_EQ(3u, items_after_insertion.size());
+
+ // 7. Test removeAll().
+ ExecuteScriptWaitForTitle(embedder, "removeAllItems()", "ITEM_ALL_REMOVED");
+ MenuItem::List items_after_all_removal = GetItems();
+ ASSERT_EQ(0u, items_after_all_removal.size());
+}
+
IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllow) {
MediaAccessAPIAllowTestHelper("testAllow");
}
<< message_;
}
-IN_PROC_BROWSER_TEST_F(WebViewTest, SpeechRecognition) {
+#if defined(OS_CHROMEOS)
+IN_PROC_BROWSER_TEST_F(WebViewTest, ChromeVoxInjection) {
+ EXPECT_FALSE(
+ chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
+
ASSERT_TRUE(StartEmbeddedTestServer());
content::WebContents* guest_web_contents = LoadGuest(
- "/extensions/platform_apps/web_view/speech/guest.html",
- "web_view/speech");
+ "/extensions/platform_apps/web_view/chromevox_injection/guest.html",
+ "web_view/chromevox_injection");
ASSERT_TRUE(guest_web_contents);
- // Click on the guest (center of the WebContents), the guest is rendered in a
- // way that this will trigger clicking on speech recognition input mic.
- SimulateMouseClick(guest_web_contents, 0, WebKit::WebMouseEvent::ButtonLeft);
+ chromeos::SpeechMonitor monitor;
+ chromeos::AccessibilityManager::Get()->EnableSpokenFeedback(
+ true, ash::A11Y_NOTIFICATION_NONE);
+ EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
- string16 expected_title(ASCIIToUTF16("PASSED"));
- string16 error_title(ASCIIToUTF16("FAILED"));
- content::TitleWatcher title_watcher(guest_web_contents, expected_title);
- title_watcher.AlsoWaitForTitle(error_title);
- EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
+ EXPECT_EQ("chrome vox test title", monitor.GetNextUtterance());
}
+#endif
// Flaky on Windows. http://crbug.com/303966
#if defined(OS_WIN)
#define MAYBE_TearDownTest TearDownTest
#endif
IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_TearDownTest) {
- ExtensionTestMessageListener first_loaded_listener("guest-loaded", false);
const extensions::Extension* extension =
- LoadAndLaunchPlatformApp("web_view/teardown");
- ASSERT_TRUE(first_loaded_listener.WaitUntilSatisfied());
- apps::ShellWindow* window = NULL;
- if (!GetShellWindowCount())
- window = CreateShellWindow(extension);
+ LoadAndLaunchPlatformApp("web_view/teardown", "guest-loaded");
+ apps::AppWindow* window = NULL;
+ if (!GetAppWindowCount())
+ window = CreateAppWindow(extension);
else
- window = GetFirstShellWindow();
- CloseShellWindow(window);
+ window = GetFirstAppWindow();
+ CloseAppWindow(window);
// Load the app again.
- ExtensionTestMessageListener second_loaded_listener("guest-loaded", false);
- LoadAndLaunchPlatformApp("web_view/teardown");
- ASSERT_TRUE(second_loaded_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/teardown", "guest-loaded");
}
// In following GeolocationAPIEmbedderHasNoAccess* tests, embedder (i.e. the
// Note that the test name prefix must be "GeolocationAPI".
IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasNoAccessAllow) {
TestHelper("testDenyDenies",
- "DoneGeolocationTest.PASSED",
- "DoneGeolocationTest.FAILED",
- "web_view/geolocation/embedder_has_no_permission");
+ "web_view/geolocation/embedder_has_no_permission",
+ NEEDS_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasNoAccessDeny) {
TestHelper("testDenyDenies",
- "DoneGeolocationTest.PASSED",
- "DoneGeolocationTest.FAILED",
- "web_view/geolocation/embedder_has_no_permission");
+ "web_view/geolocation/embedder_has_no_permission",
+ NEEDS_TEST_SERVER);
}
// In following GeolocationAPIEmbedderHasAccess* tests, embedder (i.e. the
// GeolocationAPI* test 1 of 3.
IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasAccessAllow) {
TestHelper("testAllow",
- "DoneGeolocationTest.PASSED",
- "DoneGeolocationTest.FAILED",
- "web_view/geolocation/embedder_has_permission");
+ "web_view/geolocation/embedder_has_permission",
+ NEEDS_TEST_SERVER);
}
// GeolocationAPI* test 2 of 3.
IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasAccessDeny) {
TestHelper("testDeny",
- "DoneGeolocationTest.PASSED",
- "DoneGeolocationTest.FAILED",
- "web_view/geolocation/embedder_has_permission");
+ "web_view/geolocation/embedder_has_permission",
+ NEEDS_TEST_SERVER);
}
// GeolocationAPI* test 3 of 3.
IN_PROC_BROWSER_TEST_F(WebViewTest,
GeolocationAPIEmbedderHasAccessMultipleBridgeIdAllow) {
TestHelper("testMultipleBridgeIdAllow",
- "DoneGeolocationTest.PASSED",
- "DoneGeolocationTest.FAILED",
- "web_view/geolocation/embedder_has_permission");
+ "web_view/geolocation/embedder_has_permission",
+ NEEDS_TEST_SERVER);
}
// Tests that
<< message_;
}
+// In following FilesystemAPIRequestFromMainThread* tests, guest request
+// filesystem access from main thread of the guest.
+// FileSystemAPIRequestFromMainThread* test 1 of 3
+IN_PROC_BROWSER_TEST_F(WebViewTest, FileSystemAPIRequestFromMainThreadAllow) {
+ TestHelper("testAllow", "web_view/filesystem/main", NEEDS_TEST_SERVER);
+}
+
+// FileSystemAPIRequestFromMainThread* test 2 of 3.
+IN_PROC_BROWSER_TEST_F(WebViewTest, FileSystemAPIRequestFromMainThreadDeny) {
+ TestHelper("testDeny", "web_view/filesystem/main", NEEDS_TEST_SERVER);
+}
+
+// FileSystemAPIRequestFromMainThread* test 3 of 3.
+IN_PROC_BROWSER_TEST_F(WebViewTest,
+ FileSystemAPIRequestFromMainThreadDefaultAllow) {
+ TestHelper("testDefaultAllow", "web_view/filesystem/main", NEEDS_TEST_SERVER);
+}
+
+// In following FilesystemAPIRequestFromWorker* tests, guest create a worker
+// to request filesystem access from worker thread.
+// FileSystemAPIRequestFromWorker* test 1 of 3
+IN_PROC_BROWSER_TEST_F(WebViewTest, FileSystemAPIRequestFromWorkerAllow) {
+ TestHelper("testAllow", "web_view/filesystem/worker", NEEDS_TEST_SERVER);
+}
+
+// FileSystemAPIRequestFromWorker* test 2 of 3.
+IN_PROC_BROWSER_TEST_F(WebViewTest, FileSystemAPIRequestFromWorkerDeny) {
+ TestHelper("testDeny", "web_view/filesystem/worker", NEEDS_TEST_SERVER);
+}
+
+// FileSystemAPIRequestFromWorker* test 3 of 3.
+IN_PROC_BROWSER_TEST_F(WebViewTest,
+ FileSystemAPIRequestFromWorkerDefaultAllow) {
+ TestHelper(
+ "testDefaultAllow", "web_view/filesystem/worker", NEEDS_TEST_SERVER);
+}
+
+// In following FilesystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* tests,
+// embedder contains a single webview guest. The guest creates a shared worker
+// to request filesystem access from worker thread.
+// FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* test 1 of 3
+IN_PROC_BROWSER_TEST_F(
+ WebViewTest,
+ FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuestAllow) {
+ TestHelper("testAllow",
+ "web_view/filesystem/shared_worker/single",
+ NEEDS_TEST_SERVER);
+}
+
+// FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* test 2 of 3.
+IN_PROC_BROWSER_TEST_F(
+ WebViewTest,
+ FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuestDeny) {
+ TestHelper("testDeny",
+ "web_view/filesystem/shared_worker/single",
+ NEEDS_TEST_SERVER);
+}
+
+// FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* test 3 of 3.
+IN_PROC_BROWSER_TEST_F(
+ WebViewTest,
+ FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuestDefaultAllow) {
+ TestHelper(
+ "testDefaultAllow",
+ "web_view/filesystem/shared_worker/single",
+ NEEDS_TEST_SERVER);
+}
+
+// In following FilesystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* tests,
+// embedder contains mutiple webview guests. Each guest creates a shared worker
+// to request filesystem access from worker thread.
+// FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* test 1 of 3
+IN_PROC_BROWSER_TEST_F(
+ WebViewTest,
+ FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuestsAllow) {
+ TestHelper("testAllow",
+ "web_view/filesystem/shared_worker/multiple",
+ NEEDS_TEST_SERVER);
+}
+
+// FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* test 2 of 3.
+IN_PROC_BROWSER_TEST_F(
+ WebViewTest,
+ FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuestsDeny) {
+ TestHelper("testDeny",
+ "web_view/filesystem/shared_worker/multiple",
+ NEEDS_TEST_SERVER);
+}
+
+// FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* test 3 of 3.
+IN_PROC_BROWSER_TEST_F(
+ WebViewTest,
+ FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuestsDefaultAllow) {
+ TestHelper(
+ "testDefaultAllow",
+ "web_view/filesystem/shared_worker/multiple",
+ NEEDS_TEST_SERVER);
+}
+
IN_PROC_BROWSER_TEST_F(WebViewTest, ClearData) {
#if defined(OS_WIN)
// Flaky on XP bot http://crbug.com/282674
// Replace WebContentsDelegate with mock version so we can intercept download
// requests.
content::WebContentsDelegate* delegate = guest_web_contents->GetDelegate();
- MockDownloadWebContentsDelegate* mock_delegate =
- new MockDownloadWebContentsDelegate(delegate);
- guest_web_contents->SetDelegate(mock_delegate);
+ scoped_ptr<MockDownloadWebContentsDelegate>
+ mock_delegate(new MockDownloadWebContentsDelegate(delegate));
+ guest_web_contents->SetDelegate(mock_delegate.get());
// Start test.
// 1. Guest requests a download that its embedder denies.
// Load the extension.
const extensions::Extension* content_script_whitelisted_extension =
LoadExtension(test_data_dir_.AppendASCII(
- "platform_apps/web_view/legacy/content_script"));
+ "platform_apps/web_view/extension_api/content_script"));
ASSERT_TRUE(content_script_whitelisted_extension);
ASSERT_EQ(extension_id, content_script_whitelisted_extension->id());
// Now load an app with <webview>.
- ExtensionTestMessageListener done_listener("DoneTest", false);
- LoadAndLaunchPlatformApp("web_view/content_script_whitelisted");
- ASSERT_TRUE(done_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/content_script_whitelisted",
+ "TEST_PASSED");
}
IN_PROC_BROWSER_TEST_F(WebViewTest, SetPropertyOnDocumentReady) {
// Tests overriding user agent.
IN_PROC_BROWSER_TEST_F(WebViewTest, UserAgent) {
- ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
ASSERT_TRUE(RunPlatformAppTestWithArg(
"platform_apps/web_view/common", "useragent")) << message_;
}
+IN_PROC_BROWSER_TEST_F(WebViewTest, UserAgent_NewWindow) {
+ ASSERT_TRUE(RunPlatformAppTestWithArg(
+ "platform_apps/web_view/common",
+ "useragent_newwindow")) << message_;
+}
+
IN_PROC_BROWSER_TEST_F(WebViewTest, NoPermission) {
ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/nopermission"))
<< message_;
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestAlertDialog) {
- TestHelper("testAlertDialog",
- "DoneDialogTest.PASSED",
- "DoneDialogTest.FAILED",
- "web_view/dialog");
+ TestHelper("testAlertDialog", "web_view/dialog", NO_TEST_SERVER);
}
-IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestConfirmDialog) {
- TestHelper("testConfirmDialog",
- "DoneDialogTest.PASSED",
- "DoneDialogTest.FAILED",
- "web_view/dialog");
+IN_PROC_BROWSER_TEST_F(WebViewTest, TestConfirmDialog) {
+ TestHelper("testConfirmDialog", "web_view/dialog", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestConfirmDialogCancel) {
- TestHelper("testConfirmDialogCancel",
- "DoneDialogTest.PASSED",
- "DoneDialogTest.FAILED",
- "web_view/dialog");
+ TestHelper("testConfirmDialogCancel", "web_view/dialog", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestConfirmDialogDefaultCancel) {
TestHelper("testConfirmDialogDefaultCancel",
- "DoneDialogTest.PASSED",
- "DoneDialogTest.FAILED",
- "web_view/dialog");
+ "web_view/dialog",
+ NO_TEST_SERVER);
}
-// TODO(fsamuel): This test consistently times out when run in parallel with
-// other tests, but consistently passes when retried http://crbug.com/314809
IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestConfirmDialogDefaultGCCancel) {
TestHelper("testConfirmDialogDefaultGCCancel",
- "DoneDialogTest.PASSED",
- "DoneDialogTest.FAILED",
- "web_view/dialog");
+ "web_view/dialog",
+ NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) {
- TestHelper("testPromptDialog",
- "DoneDialogTest.PASSED",
- "DoneDialogTest.FAILED",
- "web_view/dialog");
+ TestHelper("testPromptDialog", "web_view/dialog", NO_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, NoContentSettingsAPI) {
+ // Load the extension.
+ const extensions::Extension* content_settings_extension =
+ LoadExtension(
+ test_data_dir_.AppendASCII(
+ "platform_apps/web_view/extension_api/content_settings"));
+ ASSERT_TRUE(content_settings_extension);
+ TestHelper("testPostMessageCommChannel", "web_view/shim", NO_TEST_SERVER);
}
#if defined(ENABLE_PLUGINS)
};
IN_PROC_BROWSER_TEST_F(WebViewPluginTest, TestLoadPluginEvent) {
- TestHelper("testPluginLoadPermission",
- "DoneShimTest.PASSED",
- "DoneShimTest.FAILED",
- "web_view/shim");
+ TestHelper("testPluginLoadPermission", "web_view/shim", NO_TEST_SERVER);
}
#endif // defined(ENABLE_PLUGINS)
+
+class WebViewCaptureTest : public WebViewTest {
+ public:
+ WebViewCaptureTest() {}
+ virtual ~WebViewCaptureTest() {}
+ virtual void SetUp() OVERRIDE {
+ EnablePixelOutput();
+ WebViewTest::SetUp();
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestZoomAPI) {
+ TestHelper("testZoomAPI", "web_view/shim", NO_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestFindAPI) {
+ TestHelper("testFindAPI", "web_view/shim", NO_TEST_SERVER);
+}
+
+IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestFindAPI_findupdate) {
+ TestHelper("testFindAPI_findupdate", "web_view/shim", NO_TEST_SERVER);
+}
+
+// <webview> screenshot capture fails with ubercomp.
+// See http://crbug.com/327035.
+IN_PROC_BROWSER_TEST_F(WebViewCaptureTest,
+ DISABLED_Shim_ScreenshotCapture) {
+ TestHelper("testScreenshotCapture", "web_view/shim", NO_TEST_SERVER);
+}
+
+#if defined(OS_WIN)
+// Test is disabled on Windows because it times out often.
+// http://crbug.com/403325
+#define MAYBE_WebViewInBackgroundPage \
+ DISABLED_WebViewInBackgroundPage
+#else
+#define MAYBE_WebViewInBackgroundPage WebViewInBackgroundPage
+#endif
+IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_WebViewInBackgroundPage) {
+ ASSERT_TRUE(RunExtensionTest("platform_apps/web_view/background"))
+ << message_;
+}