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

Side by Side Diff: chrome/browser/printing/printing_layout_uitest.cc

Issue 2881028: GTTF: test server cleanup: (Closed)
Patch Set: final Created 10 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/simple_thread.h" 7 #include "base/simple_thread.h"
8 #include "base/test/test_file_util.h" 8 #include "base/test/test_file_util.h"
9 #include "base/win_util.h" 9 #include "base/win_util.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // Fails, see http://crbug.com/7721. 285 // Fails, see http://crbug.com/7721.
286 TEST_F(PrintingLayoutTextTest, FAILS_Complex) { 286 TEST_F(PrintingLayoutTextTest, FAILS_Complex) {
287 if (IsTestCaseDisabled()) 287 if (IsTestCaseDisabled())
288 return; 288 return;
289 289
290 DismissTheWindow dismisser(base::GetProcId(process())); 290 DismissTheWindow dismisser(base::GetProcId(process()));
291 base::DelegateSimpleThread close_printdlg_thread(&dismisser, 291 base::DelegateSimpleThread close_printdlg_thread(&dismisser,
292 "close_printdlg_thread"); 292 "close_printdlg_thread");
293 293
294 // Print a document, check its output. 294 // Print a document, check its output.
295 scoped_refptr<HTTPTestServer> server = 295 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot));
296 HTTPTestServer::CreateServer(kDocRoot, NULL);
297 ASSERT_TRUE(NULL != server.get()); 296 ASSERT_TRUE(NULL != server.get());
298 297
299 NavigateToURL(server->TestServerPage("files/printing/test1.html")); 298 NavigateToURL(server->TestServerPage("files/printing/test1.html"));
300 close_printdlg_thread.Start(); 299 close_printdlg_thread.Start();
301 PrintNowTab(); 300 PrintNowTab();
302 close_printdlg_thread.Join(); 301 close_printdlg_thread.Join();
303 EXPECT_EQ(0., CompareWithResult(L"test1")); 302 EXPECT_EQ(0., CompareWithResult(L"test1"));
304 } 303 }
305 304
306 struct TestPool { 305 struct TestPool {
(...skipping 10 matching lines...) Expand all
317 "files/printing/test4.html", L"test4", 316 "files/printing/test4.html", L"test4",
318 // TODO(maruel): http://b/1171450 Transparent overlays are drawn opaque 317 // TODO(maruel): http://b/1171450 Transparent overlays are drawn opaque
319 // "files/printing/test5.html", L"test5", 318 // "files/printing/test5.html", L"test5",
320 }; 319 };
321 320
322 // TODO(maruel:) http://code.google.com/p/chromium/issues/detail?id=7721 321 // TODO(maruel:) http://code.google.com/p/chromium/issues/detail?id=7721
323 TEST_F(PrintingLayoutTestHidden, DISABLED_ManyTimes) { 322 TEST_F(PrintingLayoutTestHidden, DISABLED_ManyTimes) {
324 if (IsTestCaseDisabled()) 323 if (IsTestCaseDisabled())
325 return; 324 return;
326 325
327 scoped_refptr<HTTPTestServer> server( 326 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot));
328 HTTPTestServer::CreateServer(kDocRoot, NULL));
329 ASSERT_TRUE(NULL != server.get()); 327 ASSERT_TRUE(NULL != server.get());
330 DismissTheWindow dismisser(base::GetProcId(process())); 328 DismissTheWindow dismisser(base::GetProcId(process()));
331 329
332 ASSERT_GT(arraysize(kTestPool), 0u); 330 ASSERT_GT(arraysize(kTestPool), 0u);
333 for (int i = 0; i < arraysize(kTestPool); ++i) { 331 for (int i = 0; i < arraysize(kTestPool); ++i) {
334 if (i) 332 if (i)
335 CleanupDumpDirectory(); 333 CleanupDumpDirectory();
336 const TestPool& test = kTestPool[i % arraysize(kTestPool)]; 334 const TestPool& test = kTestPool[i % arraysize(kTestPool)];
337 NavigateToURL(server->TestServerPage(test.source)); 335 NavigateToURL(server->TestServerPage(test.source));
338 base::DelegateSimpleThread close_printdlg_thread1(&dismisser, 336 base::DelegateSimpleThread close_printdlg_thread1(&dismisser,
(...skipping 29 matching lines...) Expand all
368 EXPECT_EQ(0., CompareWithResult(test.result)) << test.result; 366 EXPECT_EQ(0., CompareWithResult(test.result)) << test.result;
369 } 367 }
370 } 368 }
371 369
372 // Prints a popup and immediately closes it. 370 // Prints a popup and immediately closes it.
373 // TODO(maruel): Reenable it, it causes crashes. 371 // TODO(maruel): Reenable it, it causes crashes.
374 TEST_F(PrintingLayoutTest, DISABLED_Delayed) { 372 TEST_F(PrintingLayoutTest, DISABLED_Delayed) {
375 if (IsTestCaseDisabled()) 373 if (IsTestCaseDisabled())
376 return; 374 return;
377 375
378 scoped_refptr<HTTPTestServer> server( 376 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot));
379 HTTPTestServer::CreateServer(kDocRoot, NULL));
380 ASSERT_TRUE(NULL != server.get()); 377 ASSERT_TRUE(NULL != server.get());
381 378
382 { 379 {
383 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); 380 scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
384 ASSERT_TRUE(tab_proxy.get()); 381 ASSERT_TRUE(tab_proxy.get());
385 bool is_timeout = true; 382 bool is_timeout = true;
386 GURL url = server->TestServerPage("files/printing/popup_delayed_print.htm"); 383 GURL url = server->TestServerPage("files/printing/popup_delayed_print.htm");
387 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 384 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
388 tab_proxy->NavigateToURL(url)); 385 tab_proxy->NavigateToURL(url));
389 386
(...skipping 13 matching lines...) Expand all
403 EXPECT_EQ(0., CompareWithResult(L"popup_delayed_print")) 400 EXPECT_EQ(0., CompareWithResult(L"popup_delayed_print"))
404 << L"popup_delayed_print"; 401 << L"popup_delayed_print";
405 } 402 }
406 403
407 // Prints a popup and immediately closes it. 404 // Prints a popup and immediately closes it.
408 // TODO(maruel:) http://code.google.com/p/chromium/issues/detail?id=7721 405 // TODO(maruel:) http://code.google.com/p/chromium/issues/detail?id=7721
409 TEST_F(PrintingLayoutTest, DISABLED_IFrame) { 406 TEST_F(PrintingLayoutTest, DISABLED_IFrame) {
410 if (IsTestCaseDisabled()) 407 if (IsTestCaseDisabled())
411 return; 408 return;
412 409
413 scoped_refptr<HTTPTestServer> server( 410 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot));
414 HTTPTestServer::CreateServer(kDocRoot, NULL));
415 ASSERT_TRUE(NULL != server.get()); 411 ASSERT_TRUE(NULL != server.get());
416 412
417 { 413 {
418 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); 414 scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
419 ASSERT_TRUE(tab_proxy.get()); 415 ASSERT_TRUE(tab_proxy.get());
420 GURL url = server->TestServerPage("files/printing/iframe.htm"); 416 GURL url = server->TestServerPage("files/printing/iframe.htm");
421 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 417 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
422 tab_proxy->NavigateToURL(url)); 418 tab_proxy->NavigateToURL(url));
423 419
424 DismissTheWindow dismisser(base::GetProcId(process())); 420 DismissTheWindow dismisser(base::GetProcId(process()));
425 base::DelegateSimpleThread close_printdlg_thread(&dismisser, 421 base::DelegateSimpleThread close_printdlg_thread(&dismisser,
426 "close_printdlg_thread"); 422 "close_printdlg_thread");
427 close_printdlg_thread.Start(); 423 close_printdlg_thread.Start();
428 close_printdlg_thread.Join(); 424 close_printdlg_thread.Join();
429 425
430 // Force a navigation elsewhere to verify that it's fine with it. 426 // Force a navigation elsewhere to verify that it's fine with it.
431 url = server->TestServerPage("files/printing/test1.html"); 427 url = server->TestServerPage("files/printing/test1.html");
432 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 428 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
433 tab_proxy->NavigateToURL(url)); 429 tab_proxy->NavigateToURL(url));
434 } 430 }
435 CloseBrowserAndServer(); 431 CloseBrowserAndServer();
436 432
437 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; 433 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe";
438 } 434 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698