OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <list> | 5 #include <list> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 16 #include "base/threading/thread_restrictions.h" |
16 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
17 #include "chrome/browser/extensions/browsertest_util.h" | 18 #include "chrome/browser/extensions/browsertest_util.h" |
18 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h" | 19 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h" |
19 #include "chrome/browser/extensions/extension_browsertest.h" | 20 #include "chrome/browser/extensions/extension_browsertest.h" |
20 #include "chrome/browser/extensions/extension_management_test_util.h" | 21 #include "chrome/browser/extensions/extension_management_test_util.h" |
21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
22 #include "chrome/browser/extensions/policy_extension_reinstaller.h" | 23 #include "chrome/browser/extensions/policy_extension_reinstaller.h" |
23 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
24 #include "components/policy/core/browser/browser_policy_connector.h" | 25 #include "components/policy/core/browser/browser_policy_connector.h" |
25 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 26 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 job_observer.ExpectJobResult(id, script_relfilepath, | 536 job_observer.ExpectJobResult(id, script_relfilepath, |
536 JobObserver::Result::SUCCESS); | 537 JobObserver::Result::SUCCESS); |
537 EnableExtension(id); | 538 EnableExtension(id); |
538 EXPECT_TRUE(job_observer.WaitForExpectedJobs()); | 539 EXPECT_TRUE(job_observer.WaitForExpectedJobs()); |
539 | 540 |
540 // Now alter the contents of the content script, reload the extension, and | 541 // Now alter the contents of the content script, reload the extension, and |
541 // expect to see a job failure due to the content script content hash not | 542 // expect to see a job failure due to the content script content hash not |
542 // being what was signed by the webstore. | 543 // being what was signed by the webstore. |
543 base::FilePath scriptfile = extension->path().AppendASCII(script_relpath); | 544 base::FilePath scriptfile = extension->path().AppendASCII(script_relpath); |
544 std::string extra = "some_extra_function_call();"; | 545 std::string extra = "some_extra_function_call();"; |
545 ASSERT_TRUE(base::AppendToFile(scriptfile, extra.data(), extra.size())); | 546 { |
| 547 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 548 ASSERT_TRUE(base::AppendToFile(scriptfile, extra.data(), extra.size())); |
| 549 } |
546 DisableExtension(id); | 550 DisableExtension(id); |
547 job_observer.ExpectJobResult(id, script_relfilepath, | 551 job_observer.ExpectJobResult(id, script_relfilepath, |
548 JobObserver::Result::FAILURE); | 552 JobObserver::Result::FAILURE); |
549 EnableExtension(id); | 553 EnableExtension(id); |
550 EXPECT_TRUE(job_observer.WaitForExpectedJobs()); | 554 EXPECT_TRUE(job_observer.WaitForExpectedJobs()); |
551 } | 555 } |
552 | 556 |
553 protected: | 557 protected: |
554 JobDelegate delegate_; | 558 JobDelegate delegate_; |
555 GURL page_url_; | 559 GURL page_url_; |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 // Remove the override and set ExtensionService to update again. The extension | 903 // Remove the override and set ExtensionService to update again. The extension |
900 // should be now installed. | 904 // should be now installed. |
901 PolicyExtensionReinstaller::set_policy_reinstall_action_for_test(nullptr); | 905 PolicyExtensionReinstaller::set_policy_reinstall_action_for_test(nullptr); |
902 service->set_external_updates_disabled_for_test(false); | 906 service->set_external_updates_disabled_for_test(false); |
903 delay_tracker.Proceed(); | 907 delay_tracker.Proceed(); |
904 | 908 |
905 EXPECT_TRUE(registry_observer.WaitForInstall(id_)); | 909 EXPECT_TRUE(registry_observer.WaitForInstall(id_)); |
906 } | 910 } |
907 | 911 |
908 } // namespace extensions | 912 } // namespace extensions |
OLD | NEW |