| 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 "chrome/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 mime_type_info.mime_type = mime_type; | 55 mime_type_info.mime_type = mime_type; |
| 56 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl")); | 56 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl")); |
| 57 mime_type_info.additional_param_values.push_back( | 57 mime_type_info.additional_param_values.push_back( |
| 58 UTF8ToUTF16(manifest_url)); | 58 UTF8ToUTF16(manifest_url)); |
| 59 info->mime_types.push_back(mime_type_info); | 59 info->mime_types.push_back(mime_type_info); |
| 60 } | 60 } |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 typedef testing::Test ChromeContentRendererClientTest; | 63 typedef testing::Test ChromeContentRendererClientTest; |
| 64 | 64 |
| 65 #if !defined(__arm__) |
| 66 // The ARM ABI is not quite stable, so we only allow NaCl for |
| 67 // unrestricted extensions (i.e. built-in and under development). |
| 68 // Disable this whole test for ARM; other ABIs give us content-type coverage. |
| 69 // See http://crbug.com/145694 |
| 70 // TODO(dschuff): remove this when the ARM ABI is stable |
| 65 TEST_F(ChromeContentRendererClientTest, NaClRestriction) { | 71 TEST_F(ChromeContentRendererClientTest, NaClRestriction) { |
| 66 // Unknown content types have no NaCl module. | 72 // Unknown content types have no NaCl module. |
| 67 { | 73 { |
| 68 WebPluginInfo info; | 74 WebPluginInfo info; |
| 69 EXPECT_EQ(GURL(), | 75 EXPECT_EQ(GURL(), |
| 70 ChromeContentRendererClient::GetNaClContentHandlerURL( | 76 ChromeContentRendererClient::GetNaClContentHandlerURL( |
| 71 "application/x-foo", info)); | 77 "application/x-foo", info)); |
| 72 } | 78 } |
| 73 // Known content types have a NaCl module. | 79 // Known content types have a NaCl module. |
| 74 { | 80 { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 195 } |
| 190 // Non-whitelisted URLs are blocked without --enable-nacl. | 196 // Non-whitelisted URLs are blocked without --enable-nacl. |
| 191 { | 197 { |
| 192 WebPluginParams params; | 198 WebPluginParams params; |
| 193 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( | 199 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( |
| 194 GURL(), GURL("http://plus.google.com.evil.com/games"), | 200 GURL(), GURL("http://plus.google.com.evil.com/games"), |
| 195 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, | 201 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, |
| 196 ¶ms)); | 202 ¶ms)); |
| 197 } | 203 } |
| 198 } | 204 } |
| 205 #endif // !defined(__arm__) |
| 199 | 206 |
| 200 } // namespace chrome | 207 } // namespace chrome |
| 201 | 208 |
| OLD | NEW |