OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 5 #include "base/logging.h" |
6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
10 #include "content/browser/tab_contents/tab_contents.h" | 10 #include "content/browser/tab_contents/tab_contents.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 #define MAYBE_Video FLAKY_Video | 115 #define MAYBE_Video FLAKY_Video |
116 #else | 116 #else |
117 #define MAYBE_Video Video | 117 #define MAYBE_Video Video |
118 #endif | 118 #endif |
119 | 119 |
120 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, MAYBE_Video) { | 120 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, MAYBE_Video) { |
121 EXPECT_TRUE(RunExtensionSubtest( | 121 EXPECT_TRUE(RunExtensionSubtest( |
122 "extension_resource_request_policy/extension2", | 122 "extension_resource_request_policy/extension2", |
123 "video.html")); | 123 "video.html")); |
124 } | 124 } |
| 125 |
| 126 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, |
| 127 WebAccessibleResources) { |
| 128 std::string result; |
| 129 ASSERT_TRUE(test_server()->Start()); |
| 130 ASSERT_TRUE(LoadExtension(test_data_dir_ |
| 131 .AppendASCII("extension_resource_request_policy") |
| 132 .AppendASCII("web_accessible"))); |
| 133 |
| 134 GURL accessible_resource( |
| 135 test_server()->GetURL( |
| 136 "files/extensions/api_test/extension_resource_request_policy/" |
| 137 "web_accessible/accessible_resource.html")); |
| 138 ui_test_utils::NavigateToURL(browser(), accessible_resource); |
| 139 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
| 140 browser()->GetSelectedTabContents()->render_view_host(), L"", |
| 141 L"window.domAutomationController.send(document.title)", |
| 142 &result)); |
| 143 EXPECT_EQ("Loaded", result); |
| 144 |
| 145 GURL nonaccessible_resource( |
| 146 test_server()->GetURL( |
| 147 "files/extensions/api_test/extension_resource_request_policy/" |
| 148 "web_accessible/nonaccessible_resource.html")); |
| 149 ui_test_utils::NavigateToURL(browser(), nonaccessible_resource); |
| 150 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
| 151 browser()->GetSelectedTabContents()->render_view_host(), L"", |
| 152 L"window.domAutomationController.send(document.title)", |
| 153 &result)); |
| 154 EXPECT_EQ("Image failed to load", result); |
| 155 |
| 156 GURL nonexistent_resource( |
| 157 test_server()->GetURL( |
| 158 "files/extensions/api_test/extension_resource_request_policy/" |
| 159 "web_accessible/nonexistent_resource.html")); |
| 160 ui_test_utils::NavigateToURL(browser(), nonexistent_resource); |
| 161 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
| 162 browser()->GetSelectedTabContents()->render_view_host(), L"", |
| 163 L"window.domAutomationController.send(document.title)", |
| 164 &result)); |
| 165 EXPECT_EQ("Image failed to load", result); |
| 166 } |
| 167 |
OLD | NEW |