| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <sstream> | 5 #include <sstream> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 TEST_F(ResourceDispatcherTest, SniffNoContentTypeNoData) { | 63 TEST_F(ResourceDispatcherTest, SniffNoContentTypeNoData) { |
| 64 CheckTitleTest(L"content-sniffer-test3.html", | 64 CheckTitleTest(L"content-sniffer-test3.html", |
| 65 L"Content Sniffer Test 3"); | 65 L"Content Sniffer Test 3"); |
| 66 PlatformThread::Sleep(sleep_timeout_ms() * 2); | 66 PlatformThread::Sleep(sleep_timeout_ms() * 2); |
| 67 EXPECT_EQ(1, GetTabCount()); | 67 EXPECT_EQ(1, GetTabCount()); |
| 68 | 68 |
| 69 // Make sure the download shelf is not showing. | 69 // Make sure the download shelf is not showing. |
| 70 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 70 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 71 scoped_refptr<TabProxy> dl_tab(browser->GetTab(0)); | |
| 72 ASSERT_TRUE(dl_tab.get()); | |
| 73 | |
| 74 bool visible = false; | 71 bool visible = false; |
| 75 ASSERT_TRUE(dl_tab->IsShelfVisible(&visible)); | 72 ASSERT_TRUE(browser->IsShelfVisible(&visible)); |
| 76 EXPECT_FALSE(visible); | 73 EXPECT_FALSE(visible); |
| 77 } | 74 } |
| 78 | 75 |
| 79 TEST_F(ResourceDispatcherTest, ContentDispositionEmpty) { | 76 TEST_F(ResourceDispatcherTest, ContentDispositionEmpty) { |
| 80 CheckTitleTest(L"content-disposition-empty.html", L"success"); | 77 CheckTitleTest(L"content-disposition-empty.html", L"success"); |
| 81 } | 78 } |
| 82 | 79 |
| 83 TEST_F(ResourceDispatcherTest, ContentDispositionInline) { | 80 TEST_F(ResourceDispatcherTest, ContentDispositionInline) { |
| 84 CheckTitleTest(L"content-disposition-inline.html", L"success"); | 81 CheckTitleTest(L"content-disposition-inline.html", L"success"); |
| 85 } | 82 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 145 |
| 149 // Navigate to a new page, to dispatch unload event and trigger xhr. | 146 // Navigate to a new page, to dispatch unload event and trigger xhr. |
| 150 // (the bug would make this step hang the renderer). | 147 // (the bug would make this step hang the renderer). |
| 151 bool timed_out = false; | 148 bool timed_out = false; |
| 152 tab->NavigateToURLWithTimeout(server->TestServerPageW(L"files/title2.html"), | 149 tab->NavigateToURLWithTimeout(server->TestServerPageW(L"files/title2.html"), |
| 153 action_max_timeout_ms(), | 150 action_max_timeout_ms(), |
| 154 &timed_out); | 151 &timed_out); |
| 155 EXPECT_FALSE(timed_out); | 152 EXPECT_FALSE(timed_out); |
| 156 | 153 |
| 157 // Check that the new page got loaded, and that no download was triggered. | 154 // Check that the new page got loaded, and that no download was triggered. |
| 155 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); |
| 156 EXPECT_EQ(L"Title Of Awesomeness", tab_title); |
| 157 |
| 158 bool shelf_is_visible = false; | 158 bool shelf_is_visible = false; |
| 159 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); | 159 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 160 EXPECT_TRUE(tab->IsShelfVisible(&shelf_is_visible)); | 160 EXPECT_TRUE(browser->IsShelfVisible(&shelf_is_visible)); |
| 161 EXPECT_EQ(L"Title Of Awesomeness", tab_title); | |
| 162 EXPECT_FALSE(shelf_is_visible); | 161 EXPECT_FALSE(shelf_is_visible); |
| 163 } | 162 } |
| 164 | 163 |
| 165 // Tests that onunload is run for cross-site requests. (Bug 1114994) | 164 // Tests that onunload is run for cross-site requests. (Bug 1114994) |
| 166 TEST_F(ResourceDispatcherTest, CrossSiteOnunloadCookie) { | 165 TEST_F(ResourceDispatcherTest, CrossSiteOnunloadCookie) { |
| 167 const wchar_t kDocRoot[] = L"chrome/test/data"; | 166 const wchar_t kDocRoot[] = L"chrome/test/data"; |
| 168 scoped_refptr<HTTPTestServer> server = | 167 scoped_refptr<HTTPTestServer> server = |
| 169 HTTPTestServer::CreateServer(kDocRoot, NULL); | 168 HTTPTestServer::CreateServer(kDocRoot, NULL); |
| 170 ASSERT_TRUE(NULL != server.get()); | 169 ASSERT_TRUE(NULL != server.get()); |
| 171 | 170 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 std::string redirect_url = "javascript:window.location='" + | 299 std::string redirect_url = "javascript:window.location='" + |
| 301 test_url.possibly_invalid_spec() + "'"; | 300 test_url.possibly_invalid_spec() + "'"; |
| 302 tab->NavigateToURLAsync(GURL(redirect_url)); | 301 tab->NavigateToURLAsync(GURL(redirect_url)); |
| 303 // Wait for JavaScript redirect to happen. | 302 // Wait for JavaScript redirect to happen. |
| 304 PlatformThread::Sleep(sleep_timeout_ms() * 3); | 303 PlatformThread::Sleep(sleep_timeout_ms() * 3); |
| 305 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); | 304 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); |
| 306 EXPECT_EQ(L"Title Of Awesomeness", tab_title); | 305 EXPECT_EQ(L"Title Of Awesomeness", tab_title); |
| 307 } | 306 } |
| 308 | 307 |
| 309 } // namespace | 308 } // namespace |
| OLD | NEW |