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

Side by Side Diff: components/signin/core/browser/signin_header_helper_unittest.cc

Issue 2812113004: Write last_modified date to Content Settings in the PrefProvider (Closed)
Patch Set: rebase Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 5 #include <memory>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "components/content_settings/core/browser/cookie_settings.h" 9 #include "components/content_settings/core/browser/cookie_settings.h"
10 #include "components/signin/core/browser/signin_header_helper.h" 10 #include "components/signin/core/browser/signin_header_helper.h"
11 #include "components/signin/core/common/signin_switches.h" 11 #include "components/signin/core/common/signin_switches.h"
12 #include "components/sync_preferences/testing_pref_service_syncable.h" 12 #include "components/sync_preferences/testing_pref_service_syncable.h"
13 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" 13 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
14 #include "net/url_request/url_request_test_util.h" 14 #include "net/url_request/url_request_test_util.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 class SigninHeaderHelperTest : public testing::Test { 18 class SigninHeaderHelperTest : public testing::Test {
19 protected: 19 protected:
20 void SetUp() override { 20 void SetUp() override {
21 content_settings::CookieSettings::RegisterProfilePrefs(prefs_.registry()); 21 content_settings::CookieSettings::RegisterProfilePrefs(prefs_.registry());
22 HostContentSettingsMap::RegisterProfilePrefs(prefs_.registry()); 22 HostContentSettingsMap::RegisterProfilePrefs(prefs_.registry());
23 23
24 settings_map_ = new HostContentSettingsMap( 24 settings_map_ = new HostContentSettingsMap(
25 &prefs_, false /* incognito_profile */, false /* guest_profile */); 25 &prefs_, false /* incognito_profile */, false /* guest_profile */,
26 false /* store_last_modified */);
26 cookie_settings_ = 27 cookie_settings_ =
27 new content_settings::CookieSettings(settings_map_.get(), &prefs_, ""); 28 new content_settings::CookieSettings(settings_map_.get(), &prefs_, "");
28 } 29 }
29 30
30 void TearDown() override { settings_map_->ShutdownOnUIThread(); } 31 void TearDown() override { settings_map_->ShutdownOnUIThread(); }
31 32
32 void CheckMirrorCookieRequest(const GURL& url, 33 void CheckMirrorCookieRequest(const GURL& url,
33 const std::string& account_id, 34 const std::string& account_id,
34 const std::string& expected_request) { 35 const std::string& expected_request) {
35 EXPECT_EQ(signin::BuildMirrorRequestCookieIfPossible( 36 EXPECT_EQ(signin::BuildMirrorRequestCookieIfPossible(
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 url_request->SetExtraRequestHeaderByName(signin::kChromeConnectedHeader, 200 url_request->SetExtraRequestHeaderByName(signin::kChromeConnectedHeader,
200 fake_header, false); 201 fake_header, false);
201 EXPECT_FALSE(signin::AppendOrRemoveMirrorRequestHeaderIfPossible( 202 EXPECT_FALSE(signin::AppendOrRemoveMirrorRequestHeaderIfPossible(
202 url_request.get(), redirect_url, account_id, cookie_settings_.get(), 203 url_request.get(), redirect_url, account_id, cookie_settings_.get(),
203 signin::PROFILE_MODE_DEFAULT)); 204 signin::PROFILE_MODE_DEFAULT));
204 std::string header; 205 std::string header;
205 EXPECT_TRUE(url_request->extra_request_headers().GetHeader( 206 EXPECT_TRUE(url_request->extra_request_headers().GetHeader(
206 signin::kChromeConnectedHeader, &header)); 207 signin::kChromeConnectedHeader, &header));
207 EXPECT_EQ(fake_header, header); 208 EXPECT_EQ(fake_header, header);
208 } 209 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698