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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 void CheckURLIsBlocked(Browser* browser, const char* spec) { | 233 void CheckURLIsBlocked(Browser* browser, const char* spec) { |
234 GURL url(spec); | 234 GURL url(spec); |
235 ui_test_utils::NavigateToURL(browser, url); | 235 ui_test_utils::NavigateToURL(browser, url); |
236 content::WebContents* contents = | 236 content::WebContents* contents = |
237 browser->tab_strip_model()->GetActiveWebContents(); | 237 browser->tab_strip_model()->GetActiveWebContents(); |
238 EXPECT_EQ(url, contents->GetURL()); | 238 EXPECT_EQ(url, contents->GetURL()); |
239 string16 title = UTF8ToUTF16(url.spec() + " is not available"); | 239 string16 title = UTF8ToUTF16(url.spec() + " is not available"); |
240 EXPECT_EQ(title, contents->GetTitle()); | 240 EXPECT_EQ(title, contents->GetTitle()); |
241 | 241 |
242 // Verify that the expected error page is being displayed. | 242 // Verify that the expected error page is being displayed. |
243 // (error 138 == NETWORK_ACCESS_DENIED) | |
244 bool result = false; | 243 bool result = false; |
245 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 244 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
246 contents, | 245 contents, |
247 "var hasError = false;" | 246 "var textContent = document.body.textContent;" |
248 "var error = document.getElementById('errorDetails');" | 247 "var hasError = textContent.indexOf('NETWORK_ACCESS_DENIED') != -1;" |
249 "if (error)" | |
250 " hasError = error.textContent.indexOf('Error 138') == 0;" | |
251 "domAutomationController.send(hasError);", | 248 "domAutomationController.send(hasError);", |
252 &result)); | 249 &result)); |
253 EXPECT_TRUE(result); | 250 EXPECT_TRUE(result); |
254 } | 251 } |
255 | 252 |
256 // Downloads a file named |file| and expects it to be saved to |dir|, which | 253 // Downloads a file named |file| and expects it to be saved to |dir|, which |
257 // must be empty. | 254 // must be empty. |
258 void DownloadAndVerifyFile( | 255 void DownloadAndVerifyFile( |
259 Browser* browser, const base::FilePath& dir, const base::FilePath& file) { | 256 Browser* browser, const base::FilePath& dir, const base::FilePath& file) { |
260 content::DownloadManager* download_manager = | 257 content::DownloadManager* download_manager = |
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1902 this)); | 1899 this)); |
1903 | 1900 |
1904 MessageLoop::current()->Run(); | 1901 MessageLoop::current()->Run(); |
1905 } | 1902 } |
1906 | 1903 |
1907 INSTANTIATE_TEST_CASE_P(MediaStreamDevicesControllerBrowserTestInstance, | 1904 INSTANTIATE_TEST_CASE_P(MediaStreamDevicesControllerBrowserTestInstance, |
1908 MediaStreamDevicesControllerBrowserTest, | 1905 MediaStreamDevicesControllerBrowserTest, |
1909 testing::Bool()); | 1906 testing::Bool()); |
1910 | 1907 |
1911 } // namespace policy | 1908 } // namespace policy |
OLD | NEW |