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

Side by Side Diff: chrome/browser/tab_restore_uitest.cc

Issue 3034038: GTTF: Move more test server code from net/url_request/url_request_unittest.h (Closed)
Patch Set: hopefully final Created 10 years, 4 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include "base/win_util.h" 9 #include "base/win_util.h"
10 #endif 10 #endif
11 #include "chrome/app/chrome_dll_resource.h" 11 #include "chrome/app/chrome_dll_resource.h"
12 #include "chrome/common/chrome_paths.h" 12 #include "chrome/common/chrome_paths.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
16 #include "chrome/test/automation/tab_proxy.h" 16 #include "chrome/test/automation/tab_proxy.h"
17 #include "chrome/test/automation/browser_proxy.h" 17 #include "chrome/test/automation/browser_proxy.h"
18 #include "chrome/test/automation/window_proxy.h" 18 #include "chrome/test/automation/window_proxy.h"
19 #include "chrome/test/ui/ui_test.h" 19 #include "chrome/test/ui/ui_test.h"
20 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
21 #include "net/base/net_util.h" 21 #include "net/base/net_util.h"
22 #include "net/url_request/url_request_unittest.h" 22 #include "net/test/test_server.h"
23 23
24 // http://code.google.com/p/chromium/issues/detail?id=14774 24 // http://code.google.com/p/chromium/issues/detail?id=14774
25 #if (defined(OS_WIN) || defined(OS_CHROMEOS)) && !defined(NDEBUG) 25 #if (defined(OS_WIN) || defined(OS_CHROMEOS)) && !defined(NDEBUG)
26 #define MAYBE_BasicRestoreFromClosedWindow DISABLED_BasicRestoreFromClosedWindow 26 #define MAYBE_BasicRestoreFromClosedWindow DISABLED_BasicRestoreFromClosedWindow
27 #else 27 #else
28 #define MAYBE_BasicRestoreFromClosedWindow BasicRestoreFromClosedWindow 28 #define MAYBE_BasicRestoreFromClosedWindow BasicRestoreFromClosedWindow
29 #endif 29 #endif
30 30
31 // http://crbug.com/ 31 // http://crbug.com/
32 #if defined(OS_CHROMEOS) && !defined(NDEBUG) 32 #if defined(OS_CHROMEOS) && !defined(NDEBUG)
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 CheckActiveWindow(browser_proxy.get()); 452 CheckActiveWindow(browser_proxy.get());
453 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); 453 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
454 EXPECT_EQ(2, tab_count); 454 EXPECT_EQ(2, tab_count);
455 EXPECT_EQ(url1_, GetActiveTabURL(1)); 455 EXPECT_EQ(url1_, GetActiveTabURL(1));
456 } 456 }
457 457
458 // Tests that a duplicate history entry is not created when we restore a page 458 // Tests that a duplicate history entry is not created when we restore a page
459 // to an existing SiteInstance. (Bug 1230446) 459 // to an existing SiteInstance. (Bug 1230446)
460 TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { 460 TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) {
461 const wchar_t kDocRoot[] = L"chrome/test/data"; 461 const wchar_t kDocRoot[] = L"chrome/test/data";
462 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); 462 scoped_refptr<net::HTTPTestServer> server(
463 net::HTTPTestServer::CreateServer(kDocRoot));
463 ASSERT_TRUE(NULL != server.get()); 464 ASSERT_TRUE(NULL != server.get());
464 GURL http_url1(server->TestServerPage("files/title1.html")); 465 GURL http_url1(server->TestServerPage("files/title1.html"));
465 GURL http_url2(server->TestServerPage("files/title2.html")); 466 GURL http_url2(server->TestServerPage("files/title2.html"));
466 467
467 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); 468 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
468 ASSERT_TRUE(browser_proxy.get()); 469 ASSERT_TRUE(browser_proxy.get());
469 int tab_count; 470 int tab_count;
470 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); 471 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
471 472
472 // Add a tab 473 // Add a tab
(...skipping 25 matching lines...) Expand all
498 EXPECT_EQ(http_url2, GetActiveTabURL()); 499 EXPECT_EQ(http_url2, GetActiveTabURL());
499 EXPECT_TRUE(tab->GoBack()); 500 EXPECT_TRUE(tab->GoBack());
500 EXPECT_EQ(http_url1, GetActiveTabURL()); 501 EXPECT_EQ(http_url1, GetActiveTabURL());
501 } 502 }
502 503
503 // Tests that the SiteInstances used for entries in a restored tab's history 504 // Tests that the SiteInstances used for entries in a restored tab's history
504 // are given appropriate max page IDs, even if the renderer for the entry 505 // are given appropriate max page IDs, even if the renderer for the entry
505 // already exists. (Bug 1204135) 506 // already exists. (Bug 1204135)
506 TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { 507 TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) {
507 const wchar_t kDocRoot[] = L"chrome/test/data"; 508 const wchar_t kDocRoot[] = L"chrome/test/data";
508 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); 509 scoped_refptr<net::HTTPTestServer> server(
510 net::HTTPTestServer::CreateServer(kDocRoot));
509 ASSERT_TRUE(NULL != server.get()); 511 ASSERT_TRUE(NULL != server.get());
510 GURL http_url1(server->TestServerPage("files/title1.html")); 512 GURL http_url1(server->TestServerPage("files/title1.html"));
511 GURL http_url2(server->TestServerPage("files/title2.html")); 513 GURL http_url2(server->TestServerPage("files/title2.html"));
512 514
513 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); 515 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
514 ASSERT_TRUE(browser_proxy.get()); 516 ASSERT_TRUE(browser_proxy.get());
515 int tab_count; 517 int tab_count;
516 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); 518 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
517 519
518 // Add a tab 520 // Add a tab
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 641
640 // See if content is as expected. 642 // See if content is as expected.
641 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, 643 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false,
642 NULL)); 644 NULL));
643 } 645 }
644 646
645 // Restore tab with special URL in its navigation history, go back to that 647 // Restore tab with special URL in its navigation history, go back to that
646 // entry and see that it loads properly. See http://crbug.com/31905 648 // entry and see that it loads properly. See http://crbug.com/31905
647 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURLOnBack) { 649 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURLOnBack) {
648 const wchar_t kDocRoot[] = L"chrome/test/data"; 650 const wchar_t kDocRoot[] = L"chrome/test/data";
649 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); 651 scoped_refptr<net::HTTPTestServer> server(
652 net::HTTPTestServer::CreateServer(kDocRoot));
650 ASSERT_TRUE(server.get()); 653 ASSERT_TRUE(server.get());
651 const GURL http_url(server->TestServerPage("files/title1.html")); 654 const GURL http_url(server->TestServerPage("files/title1.html"));
652 655
653 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 656 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
654 ASSERT_TRUE(browser.get()); 657 ASSERT_TRUE(browser.get());
655 CheckActiveWindow(browser.get()); 658 CheckActiveWindow(browser.get());
656 659
657 // Navigate new tab to a special URL. 660 // Navigate new tab to a special URL.
658 const GURL special_url(chrome::kAboutCreditsURL); 661 const GURL special_url(chrome::kAboutCreditsURL);
659 ASSERT_TRUE(browser->AppendTab(special_url)); 662 ASSERT_TRUE(browser->AppendTab(special_url));
(...skipping 13 matching lines...) Expand all
673 ASSERT_TRUE(tab->WaitForTabToBeRestored(action_timeout_ms())); 676 ASSERT_TRUE(tab->WaitForTabToBeRestored(action_timeout_ms()));
674 GURL url; 677 GURL url;
675 ASSERT_TRUE(tab->GetCurrentURL(&url)); 678 ASSERT_TRUE(tab->GetCurrentURL(&url));
676 ASSERT_EQ(http_url, url); 679 ASSERT_EQ(http_url, url);
677 680
678 // Go back, and see if content is as expected. 681 // Go back, and see if content is as expected.
679 ASSERT_TRUE(tab->GoBack()); 682 ASSERT_TRUE(tab->GoBack());
680 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, 683 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false,
681 NULL)); 684 NULL));
682 } 685 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/view_source_uitest.cc ('k') | chrome/browser/views/find_bar_host_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698