| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/google/google_util.h" | 7 #include "chrome/browser/google/google_util.h" |
| 8 #include "chrome/browser/net/url_request_mock_util.h" | 8 #include "chrome/browser/net/url_request_mock_util.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 test_navigation_observer.WaitForObservation( | 110 test_navigation_observer.WaitForObservation( |
| 111 base::Bind(&content::RunMessageLoop), | 111 base::Bind(&content::RunMessageLoop), |
| 112 base::Bind(&MessageLoop::Quit, | 112 base::Bind(&MessageLoop::Quit, |
| 113 base::Unretained(MessageLoopForUI::current()))); | 113 base::Unretained(MessageLoopForUI::current()))); |
| 114 | 114 |
| 115 EXPECT_EQ(title_watcher.WaitAndGetTitle(), ASCIIToUTF16(expected_title)); | 115 EXPECT_EQ(title_watcher.WaitAndGetTitle(), ASCIIToUTF16(expected_title)); |
| 116 } | 116 } |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 // See crbug.com/109669 | 119 // See crbug.com/109669 |
| 120 #if defined(USE_AURA) | 120 #if defined(USE_AURA) || defined(OS_WIN) || defined(OS_MACOSX) |
| 121 #define MAYBE_DNSError_Basic DISABLED_DNSError_Basic | 121 #define MAYBE_DNSError_Basic DISABLED_DNSError_Basic |
| 122 #else | 122 #else |
| 123 #define MAYBE_DNSError_Basic DNSError_Basic | 123 #define MAYBE_DNSError_Basic DNSError_Basic |
| 124 #endif | 124 #endif |
| 125 // Test that a DNS error occuring in the main frame redirects to an error page. | 125 // Test that a DNS error occuring in the main frame redirects to an error page. |
| 126 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_Basic) { | 126 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_Basic) { |
| 127 // The first navigation should fail, and the second one should be the error | 127 // The first navigation should fail, and the second one should be the error |
| 128 // page. | 128 // page. |
| 129 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); | 129 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // See crbug.com/109669 | 132 // See crbug.com/109669 |
| 133 #if defined(USE_AURA) | 133 #if defined(USE_AURA) || defined(OS_WIN) || defined(OS_MACOSX) |
| 134 #define MAYBE_DNSError_GoBack1 DISABLED_DNSError_GoBack1 | 134 #define MAYBE_DNSError_GoBack1 DISABLED_DNSError_GoBack1 |
| 135 #else | 135 #else |
| 136 #define MAYBE_DNSError_GoBack1 DNSError_GoBack1 | 136 #define MAYBE_DNSError_GoBack1 DNSError_GoBack1 |
| 137 #endif | 137 #endif |
| 138 | 138 |
| 139 // Test that a DNS error occuring in the main frame does not result in an | 139 // Test that a DNS error occuring in the main frame does not result in an |
| 140 // additional session history entry. | 140 // additional session history entry. |
| 141 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_GoBack1) { | 141 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_GoBack1) { |
| 142 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); | 142 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); |
| 143 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); | 143 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); |
| 144 GoBackAndWaitForTitle("Title Of Awesomeness", 1); | 144 GoBackAndWaitForTitle("Title Of Awesomeness", 1); |
| 145 } | 145 } |
| 146 | 146 |
| 147 // See crbug.com/109669 | 147 // See crbug.com/109669 |
| 148 #if defined(USE_AURA) | 148 #if defined(USE_AURA) || defined(OS_WIN) || defined(OS_MACOSX) |
| 149 #define MAYBE_DNSError_GoBack2 DISABLED_DNSError_GoBack2 | 149 #define MAYBE_DNSError_GoBack2 DISABLED_DNSError_GoBack2 |
| 150 #else | 150 #else |
| 151 #define MAYBE_DNSError_GoBack2 DNSError_GoBack2 | 151 #define MAYBE_DNSError_GoBack2 DNSError_GoBack2 |
| 152 #endif | 152 #endif |
| 153 // Test that a DNS error occuring in the main frame does not result in an | 153 // Test that a DNS error occuring in the main frame does not result in an |
| 154 // additional session history entry. | 154 // additional session history entry. |
| 155 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2) { | 155 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2) { |
| 156 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); | 156 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); |
| 157 | 157 |
| 158 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); | 158 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); |
| 159 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); | 159 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); |
| 160 | 160 |
| 161 GoBackAndWaitForTitle("Mock Link Doctor", 2); | 161 GoBackAndWaitForTitle("Mock Link Doctor", 2); |
| 162 GoBackAndWaitForTitle("Title Of Awesomeness", 1); | 162 GoBackAndWaitForTitle("Title Of Awesomeness", 1); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // See crbug.com/109669 | 165 // See crbug.com/109669 |
| 166 #if defined(USE_AURA) | 166 #if defined(USE_AURA) || defined(OS_WIN) || defined(OS_MACOSX) |
| 167 #define MAYBE_DNSError_GoBack2AndForward DISABLED_DNSError_GoBack2AndForward | 167 #define MAYBE_DNSError_GoBack2AndForward DISABLED_DNSError_GoBack2AndForward |
| 168 #else | 168 #else |
| 169 #define MAYBE_DNSError_GoBack2AndForward DNSError_GoBack2AndForward | 169 #define MAYBE_DNSError_GoBack2AndForward DNSError_GoBack2AndForward |
| 170 #endif | 170 #endif |
| 171 // Test that a DNS error occuring in the main frame does not result in an | 171 // Test that a DNS error occuring in the main frame does not result in an |
| 172 // additional session history entry. | 172 // additional session history entry. |
| 173 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2AndForward) { | 173 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2AndForward) { |
| 174 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); | 174 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); |
| 175 | 175 |
| 176 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); | 176 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); |
| 177 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); | 177 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); |
| 178 | 178 |
| 179 GoBackAndWaitForTitle("Mock Link Doctor", 2); | 179 GoBackAndWaitForTitle("Mock Link Doctor", 2); |
| 180 GoBackAndWaitForTitle("Title Of Awesomeness", 1); | 180 GoBackAndWaitForTitle("Title Of Awesomeness", 1); |
| 181 | 181 |
| 182 GoForwardAndWaitForTitle("Mock Link Doctor", 2); | 182 GoForwardAndWaitForTitle("Mock Link Doctor", 2); |
| 183 } | 183 } |
| 184 | 184 |
| 185 // See crbug.com/109669 | 185 // See crbug.com/109669 |
| 186 #if defined(USE_AURA) | 186 #if defined(USE_AURA) || defined(OS_WIN) || defined(OS_MACOSX) |
| 187 #define MAYBE_DNSError_GoBack2Forward2 DISABLED_DNSError_GoBack2Forward2 | 187 #define MAYBE_DNSError_GoBack2Forward2 DISABLED_DNSError_GoBack2Forward2 |
| 188 #else | 188 #else |
| 189 #define MAYBE_DNSError_GoBack2Forward2 DNSError_GoBack2Forward2 | 189 #define MAYBE_DNSError_GoBack2Forward2 DNSError_GoBack2Forward2 |
| 190 #endif | 190 #endif |
| 191 // Test that a DNS error occuring in the main frame does not result in an | 191 // Test that a DNS error occuring in the main frame does not result in an |
| 192 // additional session history entry. | 192 // additional session history entry. |
| 193 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) { | 193 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) { |
| 194 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); | 194 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); |
| 195 | 195 |
| 196 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); | 196 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 326 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 327 browser()->tab_strip_model()->GetActiveWebContents(), | 327 browser()->tab_strip_model()->GetActiveWebContents(), |
| 328 "var textContent = document.body.textContent;" | 328 "var textContent = document.body.textContent;" |
| 329 "var hasError = textContent.indexOf('ERR_NAME_NOT_RESOLVED') >= 0;" | 329 "var hasError = textContent.indexOf('ERR_NAME_NOT_RESOLVED') >= 0;" |
| 330 "domAutomationController.send(hasError);", | 330 "domAutomationController.send(hasError);", |
| 331 &result)); | 331 &result)); |
| 332 EXPECT_TRUE(result); | 332 EXPECT_TRUE(result); |
| 333 } | 333 } |
| 334 | 334 |
| 335 } // namespace | 335 } // namespace |
| OLD | NEW |