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

Side by Side Diff: chrome/browser/net/sdch_browsertest.cc

Issue 2578723002: Reduce BrowsingDataRemover's dependencies on Chrome (Closed)
Patch Set: A new callsite appeared through rebase - fixed the compilation error. Created 3 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // End-to-end SDCH tests. Uses the embedded test server to return SDCH 5 // End-to-end SDCH tests. Uses the embedded test server to return SDCH
6 // results 6 // results
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <utility> 10 #include <utility>
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" 27 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
28 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" 28 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h"
29 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
30 #include "chrome/browser/profiles/profile_manager.h" 30 #include "chrome/browser/profiles/profile_manager.h"
31 #include "chrome/browser/ui/browser.h" 31 #include "chrome/browser/ui/browser.h"
32 #include "chrome/browser/ui/browser_tabstrip.h" 32 #include "chrome/browser/ui/browser_tabstrip.h"
33 #include "chrome/browser/ui/browser_window.h" 33 #include "chrome/browser/ui/browser_window.h"
34 #include "chrome/browser/ui/tabs/tab_strip_model.h" 34 #include "chrome/browser/ui/tabs/tab_strip_model.h"
35 #include "chrome/common/chrome_paths.h" 35 #include "chrome/common/chrome_paths.h"
36 #include "chrome/test/base/in_process_browser_test.h" 36 #include "chrome/test/base/in_process_browser_test.h"
37 #include "components/browsing_data/core/browsing_data_utils.h"
37 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
38 #include "content/public/common/content_switches.h" 39 #include "content/public/common/content_switches.h"
39 #include "content/public/test/browser_test_utils.h" 40 #include "content/public/test/browser_test_utils.h"
40 #include "content/public/test/test_utils.h" 41 #include "content/public/test/test_utils.h"
41 #include "crypto/sha2.h" 42 #include "crypto/sha2.h"
42 #include "net/base/sdch_manager.h" 43 #include "net/base/sdch_manager.h"
43 #include "net/base/sdch_observer.h" 44 #include "net/base/sdch_observer.h"
44 #include "net/http/http_response_headers.h" 45 #include "net/http/http_response_headers.h"
45 #include "net/test/embedded_test_server/embedded_test_server.h" 46 #include "net/test/embedded_test_server/embedded_test_server.h"
46 #include "net/test/embedded_test_server/http_request.h" 47 #include "net/test/embedded_test_server/http_request.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 run_loop.Run(); 403 run_loop.Run();
403 DCHECK_NE(-1, fetches); 404 DCHECK_NE(-1, fetches);
404 return fetches; 405 return fetches;
405 } 406 }
406 407
407 void BrowsingDataRemoveAndWait(int remove_mask) { 408 void BrowsingDataRemoveAndWait(int remove_mask) {
408 BrowsingDataRemover* remover = 409 BrowsingDataRemover* remover =
409 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile()); 410 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile());
410 BrowsingDataRemoverCompletionObserver completion_observer(remover); 411 BrowsingDataRemoverCompletionObserver completion_observer(remover);
411 remover->RemoveAndReply( 412 remover->RemoveAndReply(
412 BrowsingDataRemover::Period(browsing_data::LAST_HOUR), remove_mask, 413 browsing_data::CalculateBeginDeleteTime(browsing_data::LAST_HOUR),
413 BrowsingDataHelper::UNPROTECTED_WEB, &completion_observer); 414 browsing_data::CalculateEndDeleteTime(browsing_data::LAST_HOUR),
415 remove_mask, BrowsingDataHelper::UNPROTECTED_WEB, &completion_observer);
414 completion_observer.BlockUntilCompletion(); 416 completion_observer.BlockUntilCompletion();
415 } 417 }
416 418
417 // Something of a cheat; nuke the dictionaries off the SdchManager without 419 // Something of a cheat; nuke the dictionaries off the SdchManager without
418 // touching the cache (which browsing data remover would do). 420 // touching the cache (which browsing data remover would do).
419 void NukeSdchDictionaries() { 421 void NukeSdchDictionaries() {
420 base::RunLoop run_loop; 422 base::RunLoop run_loop;
421 content::BrowserThread::PostTaskAndReply( 423 content::BrowserThread::PostTaskAndReply(
422 content::BrowserThread::IO, FROM_HERE, 424 content::BrowserThread::IO, FROM_HERE,
423 base::Bind(&SdchBrowserTest::NukeSdchDictionariesOnIOThread, 425 base::Bind(&SdchBrowserTest::NukeSdchDictionariesOnIOThread,
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 ASSERT_TRUE(SetupIncognitoBrowser()); 712 ASSERT_TRUE(SetupIncognitoBrowser());
711 ASSERT_TRUE(ForceSdchDictionaryLoad(incognito_browser())); 713 ASSERT_TRUE(ForceSdchDictionaryLoad(incognito_browser()));
712 714
713 // Data fetches on main browser should not be SDCH encoded. 715 // Data fetches on main browser should not be SDCH encoded.
714 bool sdch_encoding_used = true; 716 bool sdch_encoding_used = true;
715 ASSERT_TRUE(GetData(&sdch_encoding_used)); 717 ASSERT_TRUE(GetData(&sdch_encoding_used));
716 EXPECT_FALSE(sdch_encoding_used); 718 EXPECT_FALSE(sdch_encoding_used);
717 } 719 }
718 720
719 } // namespace 721 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor_browsertest.cc ('k') | chrome/browser/predictors/resource_prefetch_predictor_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698