OLD | NEW |
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 "chrome/browser/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data_remover.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 io_thread_(BrowserThread::IO, &message_loop_), | 342 io_thread_(BrowserThread::IO, &message_loop_), |
343 profile_(new TestingProfile()) { | 343 profile_(new TestingProfile()) { |
344 registrar_.Add(this, chrome::NOTIFICATION_BROWSING_DATA_REMOVED, | 344 registrar_.Add(this, chrome::NOTIFICATION_BROWSING_DATA_REMOVED, |
345 content::Source<Profile>(profile_.get())); | 345 content::Source<Profile>(profile_.get())); |
346 } | 346 } |
347 | 347 |
348 virtual ~BrowsingDataRemoverTest() { | 348 virtual ~BrowsingDataRemoverTest() { |
349 } | 349 } |
350 | 350 |
351 void TearDown() { | 351 void TearDown() { |
352 // TestingProfile contains a WebKitContext. WebKitContext's destructor | 352 // TestingProfile contains a DOMStorageContext. BrowserContext's destructor |
353 // posts a message to the WEBKIT thread to delete some of its member | 353 // posts a message to the WEBKIT thread to delete some of its member |
354 // variables. We need to ensure that the profile is destroyed, and that | 354 // variables. We need to ensure that the profile is destroyed, and that |
355 // the message loop is cleared out, before destroying the threads and loop. | 355 // the message loop is cleared out, before destroying the threads and loop. |
356 // Otherwise we leak memory. | 356 // Otherwise we leak memory. |
357 profile_.reset(); | 357 profile_.reset(); |
358 message_loop_.RunAllPending(); | 358 message_loop_.RunAllPending(); |
359 } | 359 } |
360 | 360 |
361 void BlockUntilBrowsingDataRemoved(BrowsingDataRemover::TimePeriod period, | 361 void BlockUntilBrowsingDataRemoved(BrowsingDataRemover::TimePeriod period, |
362 int remove_mask, | 362 int remove_mask, |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 ASSERT_TRUE(tester->HistoryContainsURL(kOrigin1)); | 880 ASSERT_TRUE(tester->HistoryContainsURL(kOrigin1)); |
881 ASSERT_TRUE(tester->HistoryContainsURL(kOrigin2)); | 881 ASSERT_TRUE(tester->HistoryContainsURL(kOrigin2)); |
882 | 882 |
883 BlockUntilOriginDataRemoved(BrowsingDataRemover::LAST_HOUR, | 883 BlockUntilOriginDataRemoved(BrowsingDataRemover::LAST_HOUR, |
884 BrowsingDataRemover::REMOVE_HISTORY, kOrigin2, tester.get()); | 884 BrowsingDataRemover::REMOVE_HISTORY, kOrigin2, tester.get()); |
885 | 885 |
886 EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); | 886 EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); |
887 EXPECT_TRUE(tester->HistoryContainsURL(kOrigin1)); | 887 EXPECT_TRUE(tester->HistoryContainsURL(kOrigin1)); |
888 EXPECT_TRUE(tester->HistoryContainsURL(kOrigin2)); | 888 EXPECT_TRUE(tester->HistoryContainsURL(kOrigin2)); |
889 } | 889 } |
OLD | NEW |