| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/extensions/active_script_controller.h" | 10 #include "chrome/browser/extensions/active_script_controller.h" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 | 453 |
| 454 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, HostedAppRequest) { | 454 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, HostedAppRequest) { |
| 455 ASSERT_TRUE(StartEmbeddedTestServer()); | 455 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 456 GURL hosted_app_url( | 456 GURL hosted_app_url( |
| 457 embedded_test_server()->GetURL( | 457 embedded_test_server()->GetURL( |
| 458 "/extensions/api_test/webrequest_hosted_app/index.html")); | 458 "/extensions/api_test/webrequest_hosted_app/index.html")); |
| 459 scoped_refptr<Extension> hosted_app = | 459 scoped_refptr<Extension> hosted_app = |
| 460 ExtensionBuilder() | 460 ExtensionBuilder() |
| 461 .SetManifest(std::move( | 461 .SetManifest( |
| 462 DictionaryBuilder() | 462 DictionaryBuilder() |
| 463 .Set("name", "Some hosted app") | 463 .Set("name", "Some hosted app") |
| 464 .Set("version", "1") | 464 .Set("version", "1") |
| 465 .Set("manifest_version", 2) | 465 .Set("manifest_version", 2) |
| 466 .Set("app", | 466 .Set("app", DictionaryBuilder() |
| 467 std::move(DictionaryBuilder().Set( | 467 .Set("launch", DictionaryBuilder() |
| 468 "launch", std::move(DictionaryBuilder().Set( | 468 .Set("web_url", |
| 469 "web_url", hosted_app_url.spec()))))))) | 469 hosted_app_url.spec()) |
| 470 .Build()) |
| 471 .Build()) |
| 472 .Build()) |
| 470 .Build(); | 473 .Build(); |
| 471 ExtensionSystem::Get(browser()->profile()) | 474 ExtensionSystem::Get(browser()->profile()) |
| 472 ->extension_service() | 475 ->extension_service() |
| 473 ->AddExtension(hosted_app.get()); | 476 ->AddExtension(hosted_app.get()); |
| 474 | 477 |
| 475 ExtensionTestMessageListener listener1("main_frame", false); | 478 ExtensionTestMessageListener listener1("main_frame", false); |
| 476 ExtensionTestMessageListener listener2("xmlhttprequest", false); | 479 ExtensionTestMessageListener listener2("xmlhttprequest", false); |
| 477 | 480 |
| 478 ASSERT_TRUE(LoadExtension( | 481 ASSERT_TRUE(LoadExtension( |
| 479 test_data_dir_.AppendASCII("webrequest_hosted_app"))); | 482 test_data_dir_.AppendASCII("webrequest_hosted_app"))); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 ASSERT_TRUE(granter); | 540 ASSERT_TRUE(granter); |
| 538 granter->RevokeForTesting(); | 541 granter->RevokeForTesting(); |
| 539 base::RunLoop().RunUntilIdle(); | 542 base::RunLoop().RunUntilIdle(); |
| 540 PerformXhrInPage(web_contents, kHost, port, kXhrPath); | 543 PerformXhrInPage(web_contents, kHost, port, kXhrPath); |
| 541 EXPECT_EQ(1, GetWebRequestCountFromBackgroundPage(extension, profile())); | 544 EXPECT_EQ(1, GetWebRequestCountFromBackgroundPage(extension, profile())); |
| 542 EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, | 545 EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, |
| 543 controller->GetBlockedActions(extension)); | 546 controller->GetBlockedActions(extension)); |
| 544 } | 547 } |
| 545 | 548 |
| 546 } // namespace extensions | 549 } // namespace extensions |
| OLD | NEW |