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 "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
9 #include "chrome/common/extensions/extension_builder.h" | 9 #include "chrome/common/extensions/extension_builder.h" |
10 #include "chrome/common/extensions/extension_manifest_constants.h" | 10 #include "chrome/common/extensions/extension_manifest_constants.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 GURL("filesystem:chrome-extension://" + | 335 GURL("filesystem:chrome-extension://" + |
336 kRandomExtensionID + "/foo"))); | 336 kRandomExtensionID + "/foo"))); |
337 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( | 337 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( |
338 GURL("filesystem:http://127.0.0.1/foo"))); | 338 GURL("filesystem:http://127.0.0.1/foo"))); |
339 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL( | 339 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL( |
340 GURL("http://127.0.0.1/foo"))); | 340 GURL("http://127.0.0.1/foo"))); |
341 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( | 341 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( |
342 GURL("filesystem:http://192.168.0.1/foo"))); | 342 GURL("filesystem:http://192.168.0.1/foo"))); |
343 } | 343 } |
344 | 344 |
| 345 TEST_F(ChromeContentRendererClientTest, SetOriginForSuggestionRequest) { |
| 346 ChromeContentRendererClient client; |
| 347 GURL result; |
| 348 client.SetOriginForSuggestionRequest( |
| 349 GURL("chrome-search://suggestion/result.js"), |
| 350 GURL("http://sanity.example.com"), &result); |
| 351 EXPECT_EQ( |
| 352 GURL("chrome-search://suggestion/result.js?" |
| 353 "origin=http://sanity.example.com"), result); |
| 354 client.SetOriginForSuggestionRequest( |
| 355 GURL("chrome-search://suggestion/result.js?" |
| 356 "origin=http://good.example.com/"), |
| 357 GURL("http://evil.example.com"), &result); |
| 358 EXPECT_EQ( |
| 359 GURL("chrome-search://suggestion/result.js?" |
| 360 "origin=http://evil.example.com"), result); |
| 361 } |
| 362 |
345 } // namespace chrome | 363 } // namespace chrome |
OLD | NEW |