| 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/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data/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 27 matching lines...) Expand all Loading... |
| 38 #include "content/public/test/test_browser_thread_bundle.h" | 38 #include "content/public/test/test_browser_thread_bundle.h" |
| 39 #include "net/cookies/cookie_monster.h" | 39 #include "net/cookies/cookie_monster.h" |
| 40 #include "net/ssl/server_bound_cert_service.h" | 40 #include "net/ssl/server_bound_cert_service.h" |
| 41 #include "net/ssl/server_bound_cert_store.h" | 41 #include "net/ssl/server_bound_cert_store.h" |
| 42 #include "net/ssl/ssl_client_cert_type.h" | 42 #include "net/ssl/ssl_client_cert_type.h" |
| 43 #include "net/url_request/url_request_context.h" | 43 #include "net/url_request/url_request_context.h" |
| 44 #include "net/url_request/url_request_context_getter.h" | 44 #include "net/url_request/url_request_context_getter.h" |
| 45 #include "testing/gtest/include/gtest/gtest.h" | 45 #include "testing/gtest/include/gtest/gtest.h" |
| 46 #include "webkit/browser/quota/mock_quota_manager.h" | 46 #include "webkit/browser/quota/mock_quota_manager.h" |
| 47 #include "webkit/browser/quota/quota_manager.h" | 47 #include "webkit/browser/quota/quota_manager.h" |
| 48 #include "webkit/common/dom_storage/dom_storage_types.h" | |
| 49 #include "webkit/common/quota/quota_types.h" | 48 #include "webkit/common/quota/quota_types.h" |
| 50 | 49 |
| 51 using content::BrowserThread; | 50 using content::BrowserThread; |
| 52 | 51 |
| 53 namespace { | 52 namespace { |
| 54 | 53 |
| 55 const char kTestOrigin1[] = "http://host1:1/"; | 54 const char kTestOrigin1[] = "http://host1:1/"; |
| 56 const char kTestOrigin2[] = "http://host2:1/"; | 55 const char kTestOrigin2[] = "http://host2:1/"; |
| 57 const char kTestOrigin3[] = "http://host3:1/"; | 56 const char kTestOrigin3[] = "http://host3:1/"; |
| 58 const char kTestOriginExt[] = "chrome-extension://abcdefghijklmnopqrstuvwxyz/"; | 57 const char kTestOriginExt[] = "chrome-extension://abcdefghijklmnopqrstuvwxyz/"; |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 base::Time::Now()); | 512 base::Time::Now()); |
| 514 } | 513 } |
| 515 | 514 |
| 516 private: | 515 private: |
| 517 void GetLocalStorageUsage() { | 516 void GetLocalStorageUsage() { |
| 518 dom_storage_context_->GetLocalStorageUsage( | 517 dom_storage_context_->GetLocalStorageUsage( |
| 519 base::Bind(&RemoveLocalStorageTester::OnGotLocalStorageUsage, | 518 base::Bind(&RemoveLocalStorageTester::OnGotLocalStorageUsage, |
| 520 base::Unretained(this))); | 519 base::Unretained(this))); |
| 521 } | 520 } |
| 522 void OnGotLocalStorageUsage( | 521 void OnGotLocalStorageUsage( |
| 523 const std::vector<dom_storage::LocalStorageUsageInfo>& infos) { | 522 const std::vector<content::LocalStorageUsageInfo>& infos) { |
| 524 infos_ = infos; | 523 infos_ = infos; |
| 525 await_completion_.Notify(); | 524 await_completion_.Notify(); |
| 526 } | 525 } |
| 527 | 526 |
| 528 // We don't own these pointers. | 527 // We don't own these pointers. |
| 529 TestingProfile* profile_; | 528 TestingProfile* profile_; |
| 530 content::DOMStorageContext* dom_storage_context_; | 529 content::DOMStorageContext* dom_storage_context_; |
| 531 | 530 |
| 532 std::vector<dom_storage::LocalStorageUsageInfo> infos_; | 531 std::vector<content::LocalStorageUsageInfo> infos_; |
| 533 | 532 |
| 534 AwaitCompletionHelper await_completion_; | 533 AwaitCompletionHelper await_completion_; |
| 535 | 534 |
| 536 DISALLOW_COPY_AND_ASSIGN(RemoveLocalStorageTester); | 535 DISALLOW_COPY_AND_ASSIGN(RemoveLocalStorageTester); |
| 537 }; | 536 }; |
| 538 | 537 |
| 539 // Test Class ---------------------------------------------------------------- | 538 // Test Class ---------------------------------------------------------------- |
| 540 | 539 |
| 541 class BrowsingDataRemoverTest : public testing::Test, | 540 class BrowsingDataRemoverTest : public testing::Test, |
| 542 public content::NotificationObserver { | 541 public content::NotificationObserver { |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 BlockUntilBrowsingDataRemoved( | 1382 BlockUntilBrowsingDataRemoved( |
| 1384 BrowsingDataRemover::LAST_HOUR, | 1383 BrowsingDataRemover::LAST_HOUR, |
| 1385 BrowsingDataRemover::REMOVE_HISTORY, false); | 1384 BrowsingDataRemover::REMOVE_HISTORY, false); |
| 1386 | 1385 |
| 1387 EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); | 1386 EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); |
| 1388 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); | 1387 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); |
| 1389 EXPECT_TRUE(tester.HasOrigin(std::string())); | 1388 EXPECT_TRUE(tester.HasOrigin(std::string())); |
| 1390 EXPECT_FALSE(tester.HasOrigin(kWebOrigin)); | 1389 EXPECT_FALSE(tester.HasOrigin(kWebOrigin)); |
| 1391 EXPECT_TRUE(tester.HasOrigin(kChromeOrigin)); | 1390 EXPECT_TRUE(tester.HasOrigin(kChromeOrigin)); |
| 1392 } | 1391 } |
| OLD | NEW |