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/browsing_data_remover_browsertest.cc

Issue 2664253006: Clears out external protocol data when cookies and site data is cleared. (Closed)
Patch Set: a Created 3 years, 10 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 <stddef.h> 5 #include <stddef.h>
6 #include <memory> 6 #include <memory>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "chrome/browser/browsing_data/browsing_data_helper.h" 13 #include "chrome/browser/browsing_data/browsing_data_helper.h"
14 #include "chrome/browser/browsing_data/browsing_data_remover.h" 14 #include "chrome/browser/browsing_data/browsing_data_remover.h"
15 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" 15 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
16 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" 16 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h"
17 #include "chrome/browser/browsing_data/cache_counter.h" 17 #include "chrome/browser/browsing_data/cache_counter.h"
18 #include "chrome/browser/chrome_notification_types.h" 18 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/external_protocol/external_protocol_handler.h"
19 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" 22 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
23 #include "chrome/test/base/in_process_browser_test.h" 24 #include "chrome/test/base/in_process_browser_test.h"
24 #include "chrome/test/base/ui_test_utils.h" 25 #include "chrome/test/base/ui_test_utils.h"
25 #include "components/browsing_data/core/browsing_data_utils.h" 26 #include "components/browsing_data/core/browsing_data_utils.h"
26 #include "components/prefs/pref_service.h" 27 #include "components/prefs/pref_service.h"
27 #include "content/public/browser/browser_context.h" 28 #include "content/public/browser/browser_context.h"
28 #include "content/public/browser/browser_thread.h" 29 #include "content/public/browser/browser_thread.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 std::move(filter_builder)); 268 std::move(filter_builder));
268 EXPECT_EQ(new_size, GetCacheSize()); 269 EXPECT_EQ(new_size, GetCacheSize());
269 270
270 // Delete the remaining data. 271 // Delete the remaining data.
271 RemoveAndWait(BrowsingDataRemover::REMOVE_CACHE); 272 RemoveAndWait(BrowsingDataRemover::REMOVE_CACHE);
272 273
273 // The cache is empty. 274 // The cache is empty.
274 EXPECT_EQ(0, GetCacheSize()); 275 EXPECT_EQ(0, GetCacheSize());
275 } 276 }
276 277
278 IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest,
279 ExternalProtocolHandlerPrefs) {
280 Profile* profile = browser()->profile();
281 base::DictionaryValue prefs;
282 prefs.SetBoolean("tel", true);
283 profile->GetPrefs()->Set(prefs::kExcludedSchemes, prefs);
284 ExternalProtocolHandler::BlockState block_state =
285 ExternalProtocolHandler::GetBlockState("tel", profile);
286 ASSERT_EQ(ExternalProtocolHandler::BLOCK, block_state);
287 RemoveAndWait(BrowsingDataRemover::REMOVE_SITE_DATA);
288 block_state = ExternalProtocolHandler::GetBlockState("tel", profile);
289 ASSERT_EQ(ExternalProtocolHandler::UNKNOWN, block_state);
290 }
291
277 // Verify that TransportSecurityState data is cleared for REMOVE_CACHE. 292 // Verify that TransportSecurityState data is cleared for REMOVE_CACHE.
278 IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverTransportSecurityStateBrowserTest, 293 IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverTransportSecurityStateBrowserTest,
279 ClearTransportSecurityState) { 294 ClearTransportSecurityState) {
280 RemoveAndWait(BrowsingDataRemover::REMOVE_CACHE); 295 RemoveAndWait(BrowsingDataRemover::REMOVE_CACHE);
281 base::RunLoop run_loop; 296 base::RunLoop run_loop;
282 BrowserThread::PostTaskAndReply( 297 BrowserThread::PostTaskAndReply(
283 BrowserThread::IO, FROM_HERE, 298 BrowserThread::IO, FROM_HERE,
284 base::Bind(&BrowsingDataRemoverTransportSecurityStateBrowserTest:: 299 base::Bind(&BrowsingDataRemoverTransportSecurityStateBrowserTest::
285 CheckTransportSecurityState, 300 CheckTransportSecurityState,
286 base::Unretained(this), 301 base::Unretained(this),
(...skipping 10 matching lines...) Expand all
297 base::RunLoop run_loop; 312 base::RunLoop run_loop;
298 BrowserThread::PostTaskAndReply( 313 BrowserThread::PostTaskAndReply(
299 BrowserThread::IO, FROM_HERE, 314 BrowserThread::IO, FROM_HERE,
300 base::Bind(&BrowsingDataRemoverTransportSecurityStateBrowserTest:: 315 base::Bind(&BrowsingDataRemoverTransportSecurityStateBrowserTest::
301 CheckTransportSecurityState, 316 CheckTransportSecurityState,
302 base::Unretained(this), 317 base::Unretained(this),
303 base::RetainedRef(browser()->profile()->GetRequestContext()), 318 base::RetainedRef(browser()->profile()->GetRequestContext()),
304 false /* should not be cleared */), 319 false /* should not be cleared */),
305 run_loop.QuitClosure()); 320 run_loop.QuitClosure());
306 } 321 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698