| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "chrome/browser/ui/host_desktop.h" | 69 #include "chrome/browser/ui/host_desktop.h" |
| 70 #include "chrome/browser/ui/omnibox/location_bar.h" | 70 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 71 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 71 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
| 72 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 72 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 73 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 73 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 74 #include "chrome/common/chrome_paths.h" | 74 #include "chrome/common/chrome_paths.h" |
| 75 #include "chrome/common/chrome_switches.h" | 75 #include "chrome/common/chrome_switches.h" |
| 76 #include "chrome/common/content_settings.h" | 76 #include "chrome/common/content_settings.h" |
| 77 #include "chrome/common/content_settings_pattern.h" | 77 #include "chrome/common/content_settings_pattern.h" |
| 78 #include "chrome/common/extensions/extension_constants.h" | 78 #include "chrome/common/extensions/extension_constants.h" |
| 79 #include "chrome/common/extensions/extension_set.h" | |
| 80 #include "chrome/common/pref_names.h" | 79 #include "chrome/common/pref_names.h" |
| 81 #include "chrome/common/url_constants.h" | 80 #include "chrome/common/url_constants.h" |
| 82 #include "chrome/test/base/in_process_browser_test.h" | 81 #include "chrome/test/base/in_process_browser_test.h" |
| 83 #include "chrome/test/base/test_switches.h" | 82 #include "chrome/test/base/test_switches.h" |
| 84 #include "chrome/test/base/ui_test_utils.h" | 83 #include "chrome/test/base/ui_test_utils.h" |
| 85 #include "components/policy/core/common/external_data_fetcher.h" | 84 #include "components/policy/core/common/external_data_fetcher.h" |
| 86 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 85 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
| 87 #include "components/policy/core/common/policy_map.h" | 86 #include "components/policy/core/common/policy_map.h" |
| 88 #include "components/policy/core/common/policy_service.h" | 87 #include "components/policy/core/common/policy_service.h" |
| 89 #include "components/policy/core/common/policy_service_impl.h" | 88 #include "components/policy/core/common/policy_service_impl.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 114 #include "content/public/test/browser_test_utils.h" | 113 #include "content/public/test/browser_test_utils.h" |
| 115 #include "content/public/test/download_test_observer.h" | 114 #include "content/public/test/download_test_observer.h" |
| 116 #include "content/public/test/mock_notification_observer.h" | 115 #include "content/public/test/mock_notification_observer.h" |
| 117 #include "content/public/test/test_navigation_observer.h" | 116 #include "content/public/test/test_navigation_observer.h" |
| 118 #include "content/public/test/test_utils.h" | 117 #include "content/public/test/test_utils.h" |
| 119 #include "content/test/net/url_request_failed_job.h" | 118 #include "content/test/net/url_request_failed_job.h" |
| 120 #include "content/test/net/url_request_mock_http_job.h" | 119 #include "content/test/net/url_request_mock_http_job.h" |
| 121 #include "extensions/browser/process_manager.h" | 120 #include "extensions/browser/process_manager.h" |
| 122 #include "extensions/common/constants.h" | 121 #include "extensions/common/constants.h" |
| 123 #include "extensions/common/extension.h" | 122 #include "extensions/common/extension.h" |
| 123 #include "extensions/common/extension_set.h" |
| 124 #include "grit/generated_resources.h" | 124 #include "grit/generated_resources.h" |
| 125 #include "net/base/net_errors.h" | 125 #include "net/base/net_errors.h" |
| 126 #include "net/base/net_util.h" | 126 #include "net/base/net_util.h" |
| 127 #include "net/base/url_util.h" | 127 #include "net/base/url_util.h" |
| 128 #include "net/http/http_stream_factory.h" | 128 #include "net/http/http_stream_factory.h" |
| 129 #include "net/url_request/url_request.h" | 129 #include "net/url_request/url_request.h" |
| 130 #include "net/url_request/url_request_filter.h" | 130 #include "net/url_request/url_request_filter.h" |
| 131 #include "policy/policy_constants.h" | 131 #include "policy/policy_constants.h" |
| 132 #include "testing/gmock/include/gmock/gmock.h" | 132 #include "testing/gmock/include/gmock/gmock.h" |
| 133 #include "testing/gtest/include/gtest/gtest.h" | 133 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 base::FilePath(kTestExtensionsDir), base::FilePath(name))); | 670 base::FilePath(kTestExtensionsDir), base::FilePath(name))); |
| 671 scoped_refptr<extensions::UnpackedInstaller> installer = | 671 scoped_refptr<extensions::UnpackedInstaller> installer = |
| 672 extensions::UnpackedInstaller::Create(extension_service()); | 672 extensions::UnpackedInstaller::Create(extension_service()); |
| 673 content::WindowedNotificationObserver observer( | 673 content::WindowedNotificationObserver observer( |
| 674 expect_success ? chrome::NOTIFICATION_EXTENSION_LOADED | 674 expect_success ? chrome::NOTIFICATION_EXTENSION_LOADED |
| 675 : chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, | 675 : chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, |
| 676 content::NotificationService::AllSources()); | 676 content::NotificationService::AllSources()); |
| 677 installer->Load(extension_path); | 677 installer->Load(extension_path); |
| 678 observer.Wait(); | 678 observer.Wait(); |
| 679 | 679 |
| 680 const ExtensionSet* extensions = extension_service()->extensions(); | 680 const extensions::ExtensionSet* extensions = |
| 681 for (ExtensionSet::const_iterator it = extensions->begin(); | 681 extension_service()->extensions(); |
| 682 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
| 682 it != extensions->end(); ++it) { | 683 it != extensions->end(); ++it) { |
| 683 if ((*it)->path() == extension_path) | 684 if ((*it)->path() == extension_path) |
| 684 return it->get(); | 685 return it->get(); |
| 685 } | 686 } |
| 686 return NULL; | 687 return NULL; |
| 687 } | 688 } |
| 688 | 689 |
| 689 void UninstallExtension(const std::string& id, bool expect_success) { | 690 void UninstallExtension(const std::string& id, bool expect_success) { |
| 690 content::WindowedNotificationObserver observer( | 691 content::WindowedNotificationObserver observer( |
| 691 expect_success ? chrome::NOTIFICATION_EXTENSION_UNINSTALLED | 692 expect_success ? chrome::NOTIFICATION_EXTENSION_UNINSTALLED |
| (...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2870 chrome_variations::VariationsService::GetVariationsServerURL( | 2871 chrome_variations::VariationsService::GetVariationsServerURL( |
| 2871 g_browser_process->local_state()); | 2872 g_browser_process->local_state()); |
| 2872 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); | 2873 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); |
| 2873 std::string value; | 2874 std::string value; |
| 2874 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); | 2875 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); |
| 2875 EXPECT_EQ("restricted", value); | 2876 EXPECT_EQ("restricted", value); |
| 2876 } | 2877 } |
| 2877 #endif | 2878 #endif |
| 2878 | 2879 |
| 2879 } // namespace policy | 2880 } // namespace policy |
| OLD | NEW |