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

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: Ben's 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 #include "content/public/common/content_paths.h" 125 #include "content/public/common/content_paths.h"
126 #include "content/public/common/process_type.h" 126 #include "content/public/common/process_type.h"
127 #include "content/public/common/result_codes.h" 127 #include "content/public/common/result_codes.h"
128 #include "content/public/common/url_constants.h" 128 #include "content/public/common/url_constants.h"
129 #include "content/public/common/webplugininfo.h" 129 #include "content/public/common/webplugininfo.h"
130 #include "content/public/test/browser_test_utils.h" 130 #include "content/public/test/browser_test_utils.h"
131 #include "content/public/test/download_test_observer.h" 131 #include "content/public/test/download_test_observer.h"
132 #include "content/public/test/mock_notification_observer.h" 132 #include "content/public/test/mock_notification_observer.h"
133 #include "content/public/test/test_navigation_observer.h" 133 #include "content/public/test/test_navigation_observer.h"
134 #include "content/public/test/test_utils.h" 134 #include "content/public/test/test_utils.h"
135 #include "extensions/browser/extension_dialog_auto_confirm.h"
135 #include "extensions/browser/extension_host.h" 136 #include "extensions/browser/extension_host.h"
136 #include "extensions/browser/extension_prefs.h" 137 #include "extensions/browser/extension_prefs.h"
137 #include "extensions/browser/extension_registry.h" 138 #include "extensions/browser/extension_registry.h"
138 #include "extensions/browser/extension_system.h" 139 #include "extensions/browser/extension_system.h"
139 #include "extensions/browser/process_manager.h" 140 #include "extensions/browser/process_manager.h"
140 #include "extensions/browser/test_extension_registry_observer.h" 141 #include "extensions/browser/test_extension_registry_observer.h"
141 #include "extensions/browser/uninstall_reason.h" 142 #include "extensions/browser/uninstall_reason.h"
142 #include "extensions/common/constants.h" 143 #include "extensions/common/constants.h"
143 #include "extensions/common/extension.h" 144 #include "extensions/common/extension.h"
144 #include "extensions/common/extension_set.h" 145 #include "extensions/common/extension_set.h"
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 // Checks that a click on an extension CRX download triggers the extension 1948 // Checks that a click on an extension CRX download triggers the extension
1948 // installation prompt without further user interaction when the source is 1949 // installation prompt without further user interaction when the source is
1949 // whitelisted by policy. 1950 // whitelisted by policy.
1950 // Flaky on windows; http://crbug.com/295729 . 1951 // Flaky on windows; http://crbug.com/295729 .
1951 #if defined(OS_WIN) 1952 #if defined(OS_WIN)
1952 #define MAYBE_ExtensionInstallSources DISABLED_ExtensionInstallSources 1953 #define MAYBE_ExtensionInstallSources DISABLED_ExtensionInstallSources
1953 #else 1954 #else
1954 #define MAYBE_ExtensionInstallSources ExtensionInstallSources 1955 #define MAYBE_ExtensionInstallSources ExtensionInstallSources
1955 #endif 1956 #endif
1956 IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallSources) { 1957 IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallSources) {
1957 ExtensionInstallPrompt::g_auto_confirm_for_tests = 1958 extensions::ScopedTestDialogAutoConfirm auto_confirm(
1958 ExtensionInstallPrompt::ACCEPT; 1959 extensions::ScopedTestDialogAutoConfirm::ACCEPT);
1959 1960
1960 const GURL install_source_url(URLRequestMockHTTPJob::GetMockUrl( 1961 const GURL install_source_url(URLRequestMockHTTPJob::GetMockUrl(
1961 base::FilePath(FILE_PATH_LITERAL("extensions/*")))); 1962 base::FilePath(FILE_PATH_LITERAL("extensions/*"))));
1962 const GURL referrer_url(URLRequestMockHTTPJob::GetMockUrl( 1963 const GURL referrer_url(URLRequestMockHTTPJob::GetMockUrl(
1963 base::FilePath(FILE_PATH_LITERAL("policy/*")))); 1964 base::FilePath(FILE_PATH_LITERAL("policy/*"))));
1964 1965
1965 base::ScopedTempDir download_directory; 1966 base::ScopedTempDir download_directory;
1966 ASSERT_TRUE(download_directory.CreateUniqueTempDir()); 1967 ASSERT_TRUE(download_directory.CreateUniqueTempDir());
1967 DownloadPrefs* download_prefs = 1968 DownloadPrefs* download_prefs =
1968 DownloadPrefs::FromBrowserContext(browser()->profile()); 1969 DownloadPrefs::FromBrowserContext(browser()->profile());
(...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after
3757 PrefService* prefs = browser()->profile()->GetPrefs(); 3758 PrefService* prefs = browser()->profile()->GetPrefs();
3758 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed( 3759 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed(
3759 prefs, "host.name")); 3760 prefs, "host.name"));
3760 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( 3761 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed(
3761 prefs, "other.host.name")); 3762 prefs, "other.host.name"));
3762 } 3763 }
3763 3764
3764 #endif // !defined(CHROME_OS) 3765 #endif // !defined(CHROME_OS)
3765 3766
3766 } // namespace policy 3767 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698