diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 10:21:27 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 10:21:27 +0000 |
commit | 0e60b64fcae0a0f21982bc42e0e608c8d44b12c1 (patch) | |
tree | 5ec1f7dfc5a1955d370ef071abba840c4054271d /chrome/worker/worker_uitest.cc | |
parent | 80de4fa5861be1171ad502eba157570839601086 (diff) | |
download | chromium_src-0e60b64fcae0a0f21982bc42e0e608c8d44b12c1.zip chromium_src-0e60b64fcae0a0f21982bc42e0e608c8d44b12c1.tar.gz chromium_src-0e60b64fcae0a0f21982bc42e0e608c8d44b12c1.tar.bz2 |
[GTTF] Miscellanous UI tests cleanups:
- use built-in timeouts instead of "inventing" them in each test case
- avoid unneeded checks and operations
- use automation calls more effectively
- use FLAKY mark instead of DISABLED to maintain test coverage
- split some tests to make the above possible
TEST=UI test based
BUG=39785
Review URL: http://codereview.chromium.org/1547003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43070 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/worker/worker_uitest.cc')
-rw-r--r-- | chrome/worker/worker_uitest.cc | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/chrome/worker/worker_uitest.cc b/chrome/worker/worker_uitest.cc index b7cb91e..a356e96 100644 --- a/chrome/worker/worker_uitest.cc +++ b/chrome/worker/worker_uitest.cc @@ -33,14 +33,19 @@ class WorkerTest : public UILayoutTest { void RunIncognitoTest(const std::wstring& test_case) { scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); + ASSERT_TRUE(browser.get()); + // Open an Incognito window. - int window_count; ASSERT_TRUE(browser->RunCommand(IDC_NEW_INCOGNITO_WINDOW)); scoped_refptr<BrowserProxy> incognito(automation()->GetBrowserWindow(1)); - scoped_refptr<TabProxy> tab(incognito->GetTab(0)); + ASSERT_TRUE(incognito.get()); + int window_count; ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); ASSERT_EQ(2, window_count); + scoped_refptr<TabProxy> tab(incognito->GetTab(0)); + ASSERT_TRUE(tab.get()); + GURL url = GetTestUrl(L"workers", test_case); ASSERT_TRUE(tab->NavigateToURL(url)); @@ -155,9 +160,11 @@ const wchar_t kDocRoot[] = L"chrome/test/data/workers"; TEST_F(WorkerTest, DISABLED_WorkerHttpAuth) { scoped_refptr<HTTPTestServer> server = HTTPTestServer::CreateServer(kDocRoot, NULL); - ASSERT_TRUE(NULL != server.get()); + scoped_refptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab.get()); + GURL url = server->TestServerPage("files/worker_auth.html"); EXPECT_TRUE(NavigateAndWaitForAuth(tab, url)); } @@ -170,8 +177,10 @@ TEST_F(WorkerTest, DISABLED_SharedWorkerHttpAuth) { scoped_refptr<HTTPTestServer> server = HTTPTestServer::CreateServer(kDocRoot, NULL); ASSERT_TRUE(NULL != server.get()); + scoped_refptr<TabProxy> tab(GetActiveTab()); - EXPECT_EQ(1, GetTabCount()); + ASSERT_TRUE(tab.get()); + 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 @@ -489,10 +498,7 @@ TEST_F(WorkerTest, DISABLED_LimitPerPage) { GURL url = GetTestUrl(L"workers", L"many_workers.html"); url = GURL(url.spec() + StringPrintf("?count=%d", max_workers_per_tab + 1)); - scoped_refptr<TabProxy> tab(GetActiveTab()); - ASSERT_TRUE(tab.get()); - ASSERT_TRUE(tab->NavigateToURL(url)); - + NavigateToURL(url); ASSERT_TRUE(WaitForProcessCountToBe(1, max_workers_per_tab)); } @@ -570,6 +576,7 @@ TEST_F(WorkerTest, MultipleTabsQueuedSharedWorker) { // Create same set of workers in new tab (leaves one worker queued from this // tab). scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); + ASSERT_TRUE(window.get()); ASSERT_TRUE(window->AppendTab(url)); ASSERT_TRUE(WaitForProcessCountToBe(2, max_workers_per_tab)); @@ -600,6 +607,7 @@ TEST_F(WorkerTest, DISABLED_QueuedSharedWorkerStartedFromOtherTab) { // the same worker that was queued in the first window, to ensure it gets // connected to the first window too. scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); + ASSERT_TRUE(window.get()); GURL url2 = GetTestUrl(L"workers", L"single_shared_worker.html"); url2 = GURL(url2.spec() + StringPrintf("?id=%d", max_workers_per_tab)); ASSERT_TRUE(window->AppendTab(url2)); |