| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 void CheckURLIsBlocked(Browser* browser, const char* spec) { | 232 void CheckURLIsBlocked(Browser* browser, const char* spec) { |
| 233 GURL url(spec); | 233 GURL url(spec); |
| 234 ui_test_utils::NavigateToURL(browser, url); | 234 ui_test_utils::NavigateToURL(browser, url); |
| 235 content::WebContents* contents = | 235 content::WebContents* contents = |
| 236 browser->tab_strip_model()->GetActiveWebContents(); | 236 browser->tab_strip_model()->GetActiveWebContents(); |
| 237 EXPECT_EQ(url, contents->GetURL()); | 237 EXPECT_EQ(url, contents->GetURL()); |
| 238 string16 title = UTF8ToUTF16(url.spec() + " is not available"); | 238 string16 title = UTF8ToUTF16(url.spec() + " is not available"); |
| 239 EXPECT_EQ(title, contents->GetTitle()); | 239 EXPECT_EQ(title, contents->GetTitle()); |
| 240 | 240 |
| 241 // Verify that the expected error page is being displayed. | 241 // Verify that the expected error page is being displayed. |
| 242 // (error 138 == NETWORK_ACCESS_DENIED) | |
| 243 bool result = false; | 242 bool result = false; |
| 244 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 243 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 245 contents, | 244 contents, |
| 246 "var hasError = false;" | 245 "var textContent = document.body.textContent;" |
| 247 "var error = document.getElementById('errorDetails');" | 246 "var hasError = textContent.indexOf('NETWORK_ACCESS_DENIED') != -1;" |
| 248 "if (error)" | |
| 249 " hasError = error.textContent.indexOf('Error 138') == 0;" | |
| 250 "domAutomationController.send(hasError);", | 247 "domAutomationController.send(hasError);", |
| 251 &result)); | 248 &result)); |
| 252 EXPECT_TRUE(result); | 249 EXPECT_TRUE(result); |
| 253 } | 250 } |
| 254 | 251 |
| 255 // Downloads a file named |file| and expects it to be saved to |dir|, which | 252 // Downloads a file named |file| and expects it to be saved to |dir|, which |
| 256 // must be empty. | 253 // must be empty. |
| 257 void DownloadAndVerifyFile( | 254 void DownloadAndVerifyFile( |
| 258 Browser* browser, const base::FilePath& dir, const base::FilePath& file) { | 255 Browser* browser, const base::FilePath& dir, const base::FilePath& file) { |
| 259 content::DownloadManager* download_manager = | 256 content::DownloadManager* download_manager = |
| (...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 this)); | 1941 this)); |
| 1945 | 1942 |
| 1946 MessageLoop::current()->Run(); | 1943 MessageLoop::current()->Run(); |
| 1947 } | 1944 } |
| 1948 | 1945 |
| 1949 INSTANTIATE_TEST_CASE_P(MediaStreamDevicesControllerBrowserTestInstance, | 1946 INSTANTIATE_TEST_CASE_P(MediaStreamDevicesControllerBrowserTestInstance, |
| 1950 MediaStreamDevicesControllerBrowserTest, | 1947 MediaStreamDevicesControllerBrowserTest, |
| 1951 testing::Bool()); | 1948 testing::Bool()); |
| 1952 | 1949 |
| 1953 } // namespace policy | 1950 } // namespace policy |
| OLD | NEW |