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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/api/permissions/permissions_api.h" | 9 #include "chrome/browser/extensions/api/permissions/permissions_api.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 embedded_test_server()->GetURL("/extensions/test_file_with_body.html"); | 331 embedded_test_server()->GetURL("/extensions/test_file_with_body.html"); |
332 EXPECT_TRUE(CheckStyleInjection(browser(), url, true)); | 332 EXPECT_TRUE(CheckStyleInjection(browser(), url, true)); |
333 | 333 |
334 // The loaded extension has an exclude match for "extensions/test_file.html", | 334 // The loaded extension has an exclude match for "extensions/test_file.html", |
335 // so no CSS should be injected. | 335 // so no CSS should be injected. |
336 url = embedded_test_server()->GetURL("/extensions/test_file.html"); | 336 url = embedded_test_server()->GetURL("/extensions/test_file.html"); |
337 EXPECT_TRUE(CheckStyleInjection(browser(), url, false)); | 337 EXPECT_TRUE(CheckStyleInjection(browser(), url, false)); |
338 | 338 |
339 // We disallow all injection on the webstore. | 339 // We disallow all injection on the webstore. |
340 GURL::Replacements replacements; | 340 GURL::Replacements replacements; |
341 std::string host(kWebstoreDomain); | 341 replacements.SetHostStr(kWebstoreDomain); |
342 replacements.SetHostStr(host); | |
343 url = embedded_test_server()->GetURL("/extensions/test_file_with_body.html") | 342 url = embedded_test_server()->GetURL("/extensions/test_file_with_body.html") |
344 .ReplaceComponents(replacements); | 343 .ReplaceComponents(replacements); |
345 EXPECT_TRUE(CheckStyleInjection(browser(), url, false)); | 344 EXPECT_TRUE(CheckStyleInjection(browser(), url, false)); |
346 } | 345 } |
347 | 346 |
348 // crbug.com/120762 | 347 // crbug.com/120762 |
349 IN_PROC_BROWSER_TEST_F( | 348 IN_PROC_BROWSER_TEST_F( |
350 ExtensionApiTest, | 349 ExtensionApiTest, |
351 DISABLED_ContentScriptStylesInjectedIntoExistingRenderers) { | 350 DISABLED_ContentScriptStylesInjectedIntoExistingRenderers) { |
352 ASSERT_TRUE(StartEmbeddedTestServer()); | 351 ASSERT_TRUE(StartEmbeddedTestServer()); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 560 |
562 // The extension will have injected at idle, but it should only inject once. | 561 // The extension will have injected at idle, but it should only inject once. |
563 EXPECT_TRUE(RunAllPending(web_contents)); | 562 EXPECT_TRUE(RunAllPending(web_contents)); |
564 EXPECT_EQ(1u, dialog_helper.dialog_count()); | 563 EXPECT_EQ(1u, dialog_helper.dialog_count()); |
565 dialog_helper.CloseDialogs(); | 564 dialog_helper.CloseDialogs(); |
566 EXPECT_TRUE(RunAllPending(web_contents)); | 565 EXPECT_TRUE(RunAllPending(web_contents)); |
567 EXPECT_EQ(1u, dialog_helper.dialog_count()); | 566 EXPECT_EQ(1u, dialog_helper.dialog_count()); |
568 } | 567 } |
569 | 568 |
570 } // namespace extensions | 569 } // namespace extensions |
OLD | NEW |