Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 1148323007: [Extensions] Introduce a ScopedExtensionDialogAutoConfirm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 #include "content/public/common/content_paths.h" 126 #include "content/public/common/content_paths.h"
127 #include "content/public/common/process_type.h" 127 #include "content/public/common/process_type.h"
128 #include "content/public/common/result_codes.h" 128 #include "content/public/common/result_codes.h"
129 #include "content/public/common/url_constants.h" 129 #include "content/public/common/url_constants.h"
130 #include "content/public/common/webplugininfo.h" 130 #include "content/public/common/webplugininfo.h"
131 #include "content/public/test/browser_test_utils.h" 131 #include "content/public/test/browser_test_utils.h"
132 #include "content/public/test/download_test_observer.h" 132 #include "content/public/test/download_test_observer.h"
133 #include "content/public/test/mock_notification_observer.h" 133 #include "content/public/test/mock_notification_observer.h"
134 #include "content/public/test/test_navigation_observer.h" 134 #include "content/public/test/test_navigation_observer.h"
135 #include "content/public/test/test_utils.h" 135 #include "content/public/test/test_utils.h"
136 #include "extensions/browser/extension_dialog_auto_confirm.h"
136 #include "extensions/browser/extension_host.h" 137 #include "extensions/browser/extension_host.h"
137 #include "extensions/browser/extension_prefs.h" 138 #include "extensions/browser/extension_prefs.h"
138 #include "extensions/browser/extension_registry.h" 139 #include "extensions/browser/extension_registry.h"
139 #include "extensions/browser/extension_system.h" 140 #include "extensions/browser/extension_system.h"
140 #include "extensions/browser/process_manager.h" 141 #include "extensions/browser/process_manager.h"
141 #include "extensions/browser/test_extension_registry_observer.h" 142 #include "extensions/browser/test_extension_registry_observer.h"
142 #include "extensions/browser/uninstall_reason.h" 143 #include "extensions/browser/uninstall_reason.h"
143 #include "extensions/common/constants.h" 144 #include "extensions/common/constants.h"
144 #include "extensions/common/extension.h" 145 #include "extensions/common/extension.h"
145 #include "extensions/common/extension_set.h" 146 #include "extensions/common/extension_set.h"
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 // Checks that a click on an extension CRX download triggers the extension 1949 // Checks that a click on an extension CRX download triggers the extension
1949 // installation prompt without further user interaction when the source is 1950 // installation prompt without further user interaction when the source is
1950 // whitelisted by policy. 1951 // whitelisted by policy.
1951 // Flaky on windows; http://crbug.com/295729 . 1952 // Flaky on windows; http://crbug.com/295729 .
1952 #if defined(OS_WIN) 1953 #if defined(OS_WIN)
1953 #define MAYBE_ExtensionInstallSources DISABLED_ExtensionInstallSources 1954 #define MAYBE_ExtensionInstallSources DISABLED_ExtensionInstallSources
1954 #else 1955 #else
1955 #define MAYBE_ExtensionInstallSources ExtensionInstallSources 1956 #define MAYBE_ExtensionInstallSources ExtensionInstallSources
1956 #endif 1957 #endif
1957 IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallSources) { 1958 IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallSources) {
1958 ExtensionInstallPrompt::g_auto_confirm_for_tests = 1959 extensions::ScopedExtensionDialogAutoConfirm auto_confirm(
1959 ExtensionInstallPrompt::ACCEPT; 1960 &extensions::g_auto_confirm_install_for_testing,
1961 extensions::AUTO_CONFIRM_ACCEPT);
1960 1962
1961 const GURL install_source_url(URLRequestMockHTTPJob::GetMockUrl( 1963 const GURL install_source_url(URLRequestMockHTTPJob::GetMockUrl(
1962 base::FilePath(FILE_PATH_LITERAL("extensions/*")))); 1964 base::FilePath(FILE_PATH_LITERAL("extensions/*"))));
1963 const GURL referrer_url(URLRequestMockHTTPJob::GetMockUrl( 1965 const GURL referrer_url(URLRequestMockHTTPJob::GetMockUrl(
1964 base::FilePath(FILE_PATH_LITERAL("policy/*")))); 1966 base::FilePath(FILE_PATH_LITERAL("policy/*"))));
1965 1967
1966 base::ScopedTempDir download_directory; 1968 base::ScopedTempDir download_directory;
1967 ASSERT_TRUE(download_directory.CreateUniqueTempDir()); 1969 ASSERT_TRUE(download_directory.CreateUniqueTempDir());
1968 DownloadPrefs* download_prefs = 1970 DownloadPrefs* download_prefs =
1969 DownloadPrefs::FromBrowserContext(browser()->profile()); 1971 DownloadPrefs::FromBrowserContext(browser()->profile());
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after
3784 PrefService* prefs = browser()->profile()->GetPrefs(); 3786 PrefService* prefs = browser()->profile()->GetPrefs();
3785 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed( 3787 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed(
3786 prefs, "host.name")); 3788 prefs, "host.name"));
3787 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( 3789 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed(
3788 prefs, "other.host.name")); 3790 prefs, "other.host.name"));
3789 } 3791 }
3790 3792
3791 #endif // !defined(CHROME_OS) 3793 #endif // !defined(CHROME_OS)
3792 3794
3793 } // namespace policy 3795 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698