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

Unified Diff: chrome/browser/extensions/webstore_inline_installer_browsertest.cc

Issue 2831263003: Gate sending referrers to CWS on whether the profile has SafeBrowsing enabled. (Closed)
Patch Set: Devlin feedback. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/webstore_inline_installer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/webstore_inline_installer_browsertest.cc
diff --git a/chrome/browser/extensions/webstore_inline_installer_browsertest.cc b/chrome/browser/extensions/webstore_inline_installer_browsertest.cc
index 7c3702f5e388b9efd7d70c388dd9dae2df49bc23..7d71fb4a0bffe71e614aaff45f16d7b010a73690 100644
--- a/chrome/browser/extensions/webstore_inline_installer_browsertest.cc
+++ b/chrome/browser/extensions/webstore_inline_installer_browsertest.cc
@@ -20,8 +20,10 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/pref_names.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
+#include "components/prefs/pref_service.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/extension_registry.h"
@@ -384,9 +386,8 @@ class WebstoreInlineInstallerRedirectTest : public WebstoreInlineInstallerTest {
void ProcessServerRequest(
const net::test_server::HttpRequest& request) override {
+ cws_request_received_ = true;
if (request.content.find("redirect_chain") != std::string::npos) {
- cws_request_received_ = true;
-
std::unique_ptr<base::Value> contents =
base::JSONReader::Read(request.content);
ASSERT_EQ(base::Value::Type::DICTIONARY, contents->GetType());
@@ -440,6 +441,38 @@ IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerRedirectTest,
}
}
+// Test that an install from a page arrived at via redirects does not include
+// redirect information when SafeBrowsing is disabled.
+IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerRedirectTest,
+ NoRedirectDataWhenSafeBrowsingDisabled) {
+ PrefService* pref_service = browser()->profile()->GetPrefs();
+ EXPECT_TRUE(pref_service->GetBoolean(prefs::kSafeBrowsingEnabled));
+
+ // Disable SafeBrowsing.
+ pref_service->SetBoolean(prefs::kSafeBrowsingEnabled, false);
+
+ // Hand craft a url that will cause the test server to issue redirects.
+ const std::vector<std::string> redirects = {kRedirect1Domain,
+ kRedirect2Domain};
+ net::HostPortPair host_port = embedded_test_server()->host_port_pair();
+ std::string redirect_chain;
+ for (const auto& redirect : redirects) {
+ std::string redirect_url = base::StringPrintf(
+ "http://%s:%d/server-redirect?", redirect.c_str(), host_port.port());
+ redirect_chain += redirect_url;
+ }
+ const GURL install_url =
+ GURL(redirect_chain +
+ GenerateTestServerUrl(kAppDomain, "install.html").spec());
+
+ AutoAcceptInstall();
+ ui_test_utils::NavigateToURL(browser(), install_url);
+ RunTest("runTest");
+
+ EXPECT_TRUE(cws_request_received_);
+ ASSERT_EQ(nullptr, cws_request_json_data_);
+}
+
class WebstoreInlineInstallerListenerTest : public WebstoreInlineInstallerTest {
public:
WebstoreInlineInstallerListenerTest() {}
« no previous file with comments | « chrome/browser/extensions/webstore_inline_installer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698