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

Unified Diff: chrome/worker/worker_uitest.cc

Issue 509016: Refactored code to allow associating workers with multiple renderers. (Closed)
Patch Set: Disabled overly-aggressive assertion in ResourceDispatcherHost. Created 10 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 | « chrome/test/data/workers/worker_common.js ('k') | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/worker/worker_uitest.cc
diff --git a/chrome/worker/worker_uitest.cc b/chrome/worker/worker_uitest.cc
index 204c106311f0234263e2024a1f82b62982a84f2b..3978e75e81bbca8882dfd20d53a88650acf3c0c5 100644
--- a/chrome/worker/worker_uitest.cc
+++ b/chrome/worker/worker_uitest.cc
@@ -9,6 +9,7 @@
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/ui_layout_test.h"
+#include "net/url_request/url_request_unittest.h"
static const char kTestCompleteCookie[] = "status";
static const char kTestCompleteSuccess[] = "OK";
@@ -136,6 +137,15 @@ class WorkerTest : public UILayoutTest {
GURL about_url(std::string("file://localhost/"));
EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(about_url));
}
+
+ bool NavigateAndWaitForAuth(TabProxy* tab, const GURL& url) {
+ // Pass a large number of navigations to tell the tab to block until an auth
+ // dialog pops up.
+ bool timeout = false;
+ tab->NavigateToURLWithTimeout(url, 100, kTestWaitTimeoutMs, &timeout);
+ EXPECT_FALSE(timeout);
+ return tab->NeedsAuth();
+ }
};
@@ -173,6 +183,32 @@ TEST_F(WorkerTest, IncognitoSharedWorkers) {
RunIncognitoTest(L"incognito_worker.html");
}
+const wchar_t kDocRoot[] = L"chrome/test/data/workers";
+
+// Make sure that auth dialog is displayed from worker context.
+TEST_F(WorkerTest, WorkerHttpAuth) {
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot, NULL);
+
+ ASSERT_TRUE(NULL != server.get());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
+ GURL url = server->TestServerPage("files/worker_auth.html");
+ EXPECT_TRUE(NavigateAndWaitForAuth(tab, url));
+}
+
+// Make sure that auth dialog is displayed from shared worker context.
+TEST_F(WorkerTest, SharedWorkerHttpAuth) {
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot, NULL);
+ ASSERT_TRUE(NULL != server.get());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
+ EXPECT_EQ(1, GetTabCount());
+ GURL url = server->TestServerPage("files/shared_worker_auth.html");
+ EXPECT_TRUE(NavigateAndWaitForAuth(tab, url));
+ // TODO(atwilson): Add support to automation framework to test for auth
+ // dialogs displayed by non-navigating tabs.
+}
+
#if defined(OS_LINUX)
// Crashes on Linux - http://crbug.com/22898
#define WorkerFastLayoutTests0 DISABLED_WorkerFastLayoutTests0
« no previous file with comments | « chrome/test/data/workers/worker_common.js ('k') | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698