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

Side by Side Diff: chrome/browser/browsing_data/clear_site_data_throttle_unittest.cc

Issue 2025683003: First experimental implementation of the Clear-Site-Data header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/browsing_data/clear_site_data_throttle.h"
6
7 #include <memory>
8
9 #include "base/message_loop/message_loop.h"
10 #include "chrome/browser/browsing_data/browsing_data_remover.h"
11 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
12 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h"
13 #include "chrome/test/base/testing_profile.h"
14 #include "content/public/test/test_browser_thread.h"
15 #include "net/url_request/url_request.h"
16 #include "net/url_request/url_request_test_util.h"
17 #include "testing/gtest/include/gtest/gtest.h"
18
19 namespace {
20
21 class ClearSiteDataThrottleTest : public testing::Test {
22 public:
23 ClearSiteDataThrottleTest()
24 : ui_thread_(content::BrowserThread::UI, &ui_loop_),
25 io_thread_(content::BrowserThread::IO) {}
26
27 void SetUp() override {
28 remover_ = BrowsingDataRemoverFactory::GetForBrowserContext(&profile_);
29 }
30
31 void RunTestCase(const std::string& url) {
32 // Construct the request with given parameters.
33 std::unique_ptr<net::URLRequest> url_request_context =
34 profile_.GetRequestContext()->GetURLRequestContext()->CreateRequest(
35 GURL(url), net::DEFAULT_PRIORITY, &delegate_);
36
37 // Process the request.
38 BrowsingDataRemoverCompletionObserver completion_observer(remover_);
39 ClearSiteDataThrottle throttle(url_request_context.get());
40 bool defer;
41 throttle.WillProcessResponse(&defer);
42 completion_observer.BlockUntilCompletion();
43 }
44
45 private:
46 base::MessageLoop ui_loop_;
47 content::TestBrowserThread ui_thread_;
48 content::TestBrowserThread io_thread_;
49
50 TestingProfile profile_;
51 net::TestDelegate delegate_;
52
53 BrowsingDataRemover* remover_;
54 };
55
56 TEST_F(ClearSiteDataThrottleTest, Types) {
57 RunTestCase("www.example.com");
58 }
59
60 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698