| Index: chrome/browser/cookies_tree_model_unittest.cc
|
| diff --git a/chrome/browser/cookies_tree_model_unittest.cc b/chrome/browser/cookies_tree_model_unittest.cc
|
| index 9ff0a5cc927a4cabd4bb888b69f393e99107e443..7a0f7add89bfb4b4116034a8f3268a4415e6c46b 100644
|
| --- a/chrome/browser/cookies_tree_model_unittest.cc
|
| +++ b/chrome/browser/cookies_tree_model_unittest.cc
|
| @@ -10,6 +10,7 @@
|
| #include "chrome/browser/content_settings/stub_settings_observer.h"
|
| #include "chrome/browser/mock_browsing_data_appcache_helper.h"
|
| #include "chrome/browser/mock_browsing_data_database_helper.h"
|
| +#include "chrome/browser/mock_browsing_data_file_system_helper.h"
|
| #include "chrome/browser/mock_browsing_data_indexed_db_helper.h"
|
| #include "chrome/browser/mock_browsing_data_local_storage_helper.h"
|
| #include "chrome/test/testing_profile.h"
|
| @@ -19,6 +20,8 @@
|
| #include "net/url_request/url_request_context_getter.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| +#include "base/utf_string_conversions.h"
|
| +
|
|
|
| namespace {
|
|
|
| @@ -44,6 +47,8 @@ class CookiesTreeModelTest : public testing::Test {
|
| new MockBrowsingDataAppCacheHelper(profile_.get());
|
| mock_browsing_data_indexed_db_helper_ =
|
| new MockBrowsingDataIndexedDBHelper(profile_.get());
|
| + mock_browsing_data_file_system_helper_ =
|
| + new MockBrowsingDataFileSystemHelper(profile_.get());
|
| }
|
|
|
| CookiesTreeModel* CreateCookiesTreeModelWithInitialSample() {
|
| @@ -57,6 +62,7 @@ class CookiesTreeModelTest : public testing::Test {
|
| mock_browsing_data_session_storage_helper_,
|
| mock_browsing_data_appcache_helper_,
|
| mock_browsing_data_indexed_db_helper_,
|
| + mock_browsing_data_file_system_helper_,
|
| false);
|
| mock_browsing_data_database_helper_->AddDatabaseSamples();
|
| mock_browsing_data_database_helper_->Notify();
|
| @@ -66,19 +72,24 @@ class CookiesTreeModelTest : public testing::Test {
|
| mock_browsing_data_session_storage_helper_->Notify();
|
| mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples();
|
| mock_browsing_data_indexed_db_helper_->Notify();
|
| + mock_browsing_data_file_system_helper_->AddFileSystemSamples();
|
| + mock_browsing_data_file_system_helper_->Notify();
|
| {
|
| SCOPED_TRACE("Initial State 3 cookies, 2 databases, 2 local storages, "
|
| - "2 session storages, 2 indexed DBs");
|
| - // 32 because there's the root, then foo1 -> cookies -> a,
|
| + "2 session storages, 2 indexed DBs, 3 filesystems");
|
| + // 41 because there's the root, then foo1 -> cookies -> a,
|
| // foo2 -> cookies -> b, foo3 -> cookies -> c,
|
| // dbhost1 -> database -> db1, dbhost2 -> database -> db2,
|
| + // fshost1 -> filesystem -> http://fshost1:1/,
|
| + // fshost2 -> filesystem -> http://fshost2:1/,
|
| + // fshost3 -> filesystem -> http://fshost3:1/,
|
| // host1 -> localstorage -> http://host1:1/,
|
| // host2 -> localstorage -> http://host2:2/.
|
| // host1 -> sessionstorage -> http://host1:1/,
|
| // host2 -> sessionstorage -> http://host2:2/,
|
| // idbhost1 -> indexeddb -> http://idbhost1:1/,
|
| // idbhost2 -> indexeddb -> http://idbhost2:2/.
|
| - EXPECT_EQ(32, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount());
|
| EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model));
|
| EXPECT_EQ("http://host1:1/,http://host2:2/",
|
| GetDisplayedLocalStorages(cookies_model));
|
| @@ -86,6 +97,8 @@ class CookiesTreeModelTest : public testing::Test {
|
| GetDisplayedSessionStorages(cookies_model));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(cookies_model));
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model));
|
| }
|
| return cookies_model;
|
| }
|
| @@ -129,6 +142,9 @@ class CookiesTreeModelTest : public testing::Test {
|
| ",";
|
| case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB:
|
| return node->GetDetailedInfo().indexed_db_info->origin + ",";
|
| + case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM:
|
| + return node->GetDetailedInfo().file_system_info->origin.spec() +
|
| + ",";
|
| default:
|
| return "";
|
| }
|
| @@ -162,6 +178,11 @@ class CookiesTreeModelTest : public testing::Test {
|
| node, CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB);
|
| }
|
|
|
| + std::string GetFileSystemsOfChildren(const CookieTreeNode* node) {
|
| + return GetNodesOfChildren(
|
| + node, CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM);
|
| + }
|
| +
|
| // Get the nodes names displayed in the view (if we had one) in the order
|
| // they are displayed, as a comma seperated string.
|
| // Ex: EXPECT_STREQ("X,Y", GetDisplayedNodes(cookies_view, type).c_str());
|
| @@ -205,6 +226,11 @@ class CookiesTreeModelTest : public testing::Test {
|
| CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB);
|
| }
|
|
|
| + std::string GetDisplayedFileSystems(CookiesTreeModel* cookies_model) {
|
| + return GetDisplayedNodes(cookies_model,
|
| + CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM);
|
| + }
|
| +
|
| // Do not call on the root.
|
| void DeleteStoredObjects(CookieTreeNode* node) {
|
| node->DeleteStoredObjects();
|
| @@ -229,6 +255,8 @@ class CookiesTreeModelTest : public testing::Test {
|
| mock_browsing_data_appcache_helper_;
|
| scoped_refptr<MockBrowsingDataIndexedDBHelper>
|
| mock_browsing_data_indexed_db_helper_;
|
| + scoped_refptr<MockBrowsingDataFileSystemHelper>
|
| + mock_browsing_data_file_system_helper_;
|
| };
|
|
|
| TEST_F(CookiesTreeModelTest, RemoveAll) {
|
| @@ -249,12 +277,15 @@ TEST_F(CookiesTreeModelTest, RemoveAll) {
|
| GetDisplayedSessionStorages(cookies_model.get()));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| }
|
|
|
| mock_browsing_data_database_helper_->Reset();
|
| mock_browsing_data_local_storage_helper_->Reset();
|
| mock_browsing_data_session_storage_helper_->Reset();
|
| mock_browsing_data_indexed_db_helper_->Reset();
|
| + mock_browsing_data_file_system_helper_->Reset();
|
|
|
| cookies_model->DeleteAllStoredObjects();
|
|
|
| @@ -269,6 +300,7 @@ TEST_F(CookiesTreeModelTest, RemoveAll) {
|
| EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted());
|
| EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted());
|
| EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted());
|
| + EXPECT_TRUE(mock_browsing_data_file_system_helper_->AllDeleted());
|
| }
|
| }
|
|
|
| @@ -277,64 +309,182 @@ TEST_F(CookiesTreeModelTest, Remove) {
|
| CreateCookiesTreeModelWithInitialSample());
|
| net::CookieMonster* monster = profile_->GetCookieMonster();
|
|
|
| - DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0));
|
| + // Children start out arranged as follows:
|
| + //
|
| + // 0. `foo1`
|
| + // 1. `foo2`
|
| + // 2. `foo3`
|
| + // 3. `fshost1`
|
| + // 4. `fshost2`
|
| + // 5. `fshost3`
|
| + // 6. `gdbhost1`
|
| + // 7. `gdbhost2`
|
| + // 8. `host1`
|
| + // 9. `host2`
|
| + // 10. `idbhost1`
|
| + // 11. `idbhost2`
|
| + //
|
| + // Here, we'll remove them one by one, starting from the end, and
|
| + // check that the state makes sense.
|
| +
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(11));
|
| {
|
| - SCOPED_TRACE("First cookie origin removed");
|
| - EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str());
|
| - EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + SCOPED_TRACE("`idbhost2` removed.");
|
| + EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
|
| EXPECT_EQ("http://host1:1/,http://host2:2/",
|
| GetDisplayedLocalStorages(cookies_model.get()));
|
| EXPECT_EQ("http://host1:1/,http://host2:2/",
|
| GetDisplayedSessionStorages(cookies_model.get()));
|
| - EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("http://idbhost1:1/",
|
| GetDisplayedIndexedDBs(cookies_model.get()));
|
| - EXPECT_EQ(29, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ(38, cookies_model->GetRoot()->GetTotalNodeCount());
|
| }
|
| -
|
| - DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2));
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10));
|
| {
|
| - SCOPED_TRACE("First database origin removed");
|
| - EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str());
|
| - EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| - EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get()));
|
| + SCOPED_TRACE("`idbhost1` removed.");
|
| + EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
|
| EXPECT_EQ("http://host1:1/,http://host2:2/",
|
| GetDisplayedLocalStorages(cookies_model.get()));
|
| EXPECT_EQ("http://host1:1/,http://host2:2/",
|
| GetDisplayedSessionStorages(cookies_model.get()));
|
| - EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| - GetDisplayedIndexedDBs(cookies_model.get()));
|
| - EXPECT_EQ(26, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ(35, cookies_model->GetRoot()->GetTotalNodeCount());
|
| }
|
| -
|
| - DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3));
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(9));
|
| {
|
| - SCOPED_TRACE("First local storage origin removed");
|
| - EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str());
|
| - EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| - EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get()));
|
| - EXPECT_EQ("http://host2:2/",
|
| + SCOPED_TRACE("`host2` removed.");
|
| + EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
|
| + EXPECT_EQ("http://host1:1/",
|
| GetDisplayedLocalStorages(cookies_model.get()));
|
| - EXPECT_EQ("http://host2:2/",
|
| + EXPECT_EQ("http://host1:1/",
|
| GetDisplayedSessionStorages(cookies_model.get()));
|
| - EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| - GetDisplayedIndexedDBs(cookies_model.get()));
|
| - EXPECT_EQ(21, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ(30, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + }
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8));
|
| + {
|
| + SCOPED_TRACE("`host1` removed.");
|
| + EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ(25, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + }
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(7));
|
| + {
|
| + SCOPED_TRACE("`gdbhost2` removed.");
|
| + EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + EXPECT_EQ("db1", GetDisplayedDatabases(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ(22, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + }
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6));
|
| + {
|
| + SCOPED_TRACE("`gdbhost1` removed.");
|
| + EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ(19, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + }
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5));
|
| + {
|
| + SCOPED_TRACE("`fshost3` removed.");
|
| + EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ(16, cookies_model->GetRoot()->GetTotalNodeCount());
|
| }
|
| -
|
| DeleteStoredObjects(cookies_model->GetRoot()->GetChild(4));
|
| {
|
| - SCOPED_TRACE("First IndexedDB origin removed");
|
| - EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str());
|
| - EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| - EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get()));
|
| - EXPECT_EQ("http://host2:2/",
|
| - GetDisplayedLocalStorages(cookies_model.get()));
|
| - EXPECT_EQ("http://host2:2/",
|
| - GetDisplayedSessionStorages(cookies_model.get()));
|
| - EXPECT_EQ("http://idbhost2:2/",
|
| - GetDisplayedIndexedDBs(cookies_model.get()));
|
| - EXPECT_EQ(18, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + SCOPED_TRACE("`fshost2` removed.");
|
| + EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
|
| + EXPECT_EQ("http://fshost1:1/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ(13, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + }
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3));
|
| + {
|
| + SCOPED_TRACE("`fshost1` removed.");
|
| + EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ(10, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + }
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2));
|
| + {
|
| + SCOPED_TRACE("`foo3` removed.");
|
| + EXPECT_STREQ("A,B", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("A,B", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ(7, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + }
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(1));
|
| + {
|
| + SCOPED_TRACE("`foo2` removed.");
|
| + EXPECT_STREQ("A", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("A", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ(4, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + }
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0));
|
| + {
|
| + SCOPED_TRACE("`foo1` removed.");
|
| + EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
|
| + EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str());
|
| + EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount());
|
| }
|
| }
|
|
|
| @@ -348,15 +498,18 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) {
|
| SCOPED_TRACE("First origin removed");
|
| EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str());
|
| EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str());
|
| - // 28 because in this case, the origin remains, although the COOKIES
|
| + // 39 because in this case, the origin remains, although the COOKIES
|
| // node beneath it has been deleted. So, we have
|
| // root -> foo1 -> cookies -> a, foo2, foo3 -> cookies -> c
|
| // dbhost1 -> database -> db1, dbhost2 -> database -> db2,
|
| + // fshost1 -> filesystem -> http://fshost1:1/,
|
| + // fshost2 -> filesystem -> http://fshost2:1/,
|
| + // fshost3 -> filesystem -> http://fshost3:1/,
|
| // host1 -> localstorage -> http://host1:1/,
|
| // host2 -> localstorage -> http://host2:2/,
|
| // idbhost1 -> sessionstorage -> http://idbhost1:1/,
|
| // idbhost2 -> sessionstorage -> http://idbhost2:2/.
|
| - EXPECT_EQ(30, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ(39, cookies_model->GetRoot()->GetTotalNodeCount());
|
| EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
|
| EXPECT_EQ("http://host1:1/,http://host2:2/",
|
| GetDisplayedLocalStorages(cookies_model.get()));
|
| @@ -364,9 +517,11 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) {
|
| GetDisplayedSessionStorages(cookies_model.get()));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(cookies_model.get()));
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| }
|
|
|
| - DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)->GetChild(0));
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)->GetChild(0));
|
| {
|
| SCOPED_TRACE("First database removed");
|
| EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str());
|
| @@ -378,10 +533,12 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) {
|
| GetDisplayedSessionStorages(cookies_model.get()));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(cookies_model.get()));
|
| - EXPECT_EQ(28, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ(37, cookies_model->GetRoot()->GetTotalNodeCount());
|
| }
|
|
|
| - DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5)->GetChild(0));
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0));
|
| {
|
| SCOPED_TRACE("First origin removed");
|
| EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str());
|
| @@ -393,7 +550,9 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) {
|
| GetDisplayedSessionStorages(cookies_model.get()));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(cookies_model.get()));
|
| - EXPECT_EQ(26, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ(35, cookies_model->GetRoot()->GetTotalNodeCount());
|
| }
|
| }
|
|
|
| @@ -414,20 +573,25 @@ TEST_F(CookiesTreeModelTest, RemoveCookieNode) {
|
| GetDisplayedSessionStorages(cookies_model.get()));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(cookies_model.get()));
|
| - // 28 because in this case, the origin remains, although the COOKIES
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + // 39 because in this case, the origin remains, although the COOKIES
|
| // node beneath it has been deleted. So, we have
|
| // root -> foo1 -> cookies -> a, foo2, foo3 -> cookies -> c
|
| // dbhost1 -> database -> db1, dbhost2 -> database -> db2,
|
| + // fshost1 -> filesystem -> http://fshost1:1/,
|
| + // fshost2 -> filesystem -> http://fshost2:1/,
|
| + // fshost3 -> filesystem -> http://fshost3:1/,
|
| // host1 -> localstorage -> http://host1:1/,
|
| - // host2 -> localstorage -> http://host2:2/.
|
| + // host2 -> localstorage -> http://host2:2/,
|
| // host1 -> sessionstorage -> http://host1:1/,
|
| // host2 -> sessionstorage -> http://host2:2/,
|
| // idbhost1 -> sessionstorage -> http://idbhost1:1/,
|
| // idbhost2 -> sessionstorage -> http://idbhost2:2/.
|
| - EXPECT_EQ(30, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ(39, cookies_model->GetRoot()->GetTotalNodeCount());
|
| }
|
|
|
| - DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)->GetChild(0));
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)->GetChild(0));
|
| {
|
| SCOPED_TRACE("First database removed");
|
| EXPECT_STREQ("A,C", GetMonsterCookies(monster).c_str());
|
| @@ -439,10 +603,12 @@ TEST_F(CookiesTreeModelTest, RemoveCookieNode) {
|
| GetDisplayedSessionStorages(cookies_model.get()));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(cookies_model.get()));
|
| - EXPECT_EQ(28, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ(37, cookies_model->GetRoot()->GetTotalNodeCount());
|
| }
|
|
|
| - DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5)->GetChild(0));
|
| + DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0));
|
| {
|
| SCOPED_TRACE("First origin removed");
|
| EXPECT_STREQ("A,C", GetMonsterCookies(monster).c_str());
|
| @@ -454,7 +620,9 @@ TEST_F(CookiesTreeModelTest, RemoveCookieNode) {
|
| GetDisplayedSessionStorages(cookies_model.get()));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(cookies_model.get()));
|
| - EXPECT_EQ(26, cookies_model->GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(cookies_model.get()));
|
| + EXPECT_EQ(35, cookies_model->GetRoot()->GetTotalNodeCount());
|
| }
|
| }
|
|
|
| @@ -470,6 +638,7 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) {
|
| mock_browsing_data_session_storage_helper_,
|
| mock_browsing_data_appcache_helper_,
|
| mock_browsing_data_indexed_db_helper_,
|
| + mock_browsing_data_file_system_helper_,
|
| false);
|
| mock_browsing_data_database_helper_->AddDatabaseSamples();
|
| mock_browsing_data_database_helper_->Notify();
|
| @@ -479,20 +648,24 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) {
|
| mock_browsing_data_session_storage_helper_->Notify();
|
| mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples();
|
| mock_browsing_data_indexed_db_helper_->Notify();
|
| + mock_browsing_data_file_system_helper_->AddFileSystemSamples();
|
| + mock_browsing_data_file_system_helper_->Notify();
|
|
|
| {
|
| SCOPED_TRACE("Initial State 4 cookies, 2 databases, 2 local storages, "
|
| - "2 session storages, 2 indexed DBs");
|
| - // 33 because there's the root, then foo1 -> cookies -> a,
|
| + "2 session storages, 2 indexed DBs, 3 file systems");
|
| + // 42 because there's the root, then foo1 -> cookies -> a,
|
| // foo2 -> cookies -> b, foo3 -> cookies -> c,d
|
| // dbhost1 -> database -> db1, dbhost2 -> database -> db2,
|
| + // fshost1 -> filesystem -> http://fshost1:1/,
|
| + // fshost2 -> filesystem -> http://fshost2:1/,
|
| + // fshost3 -> filesystem -> http://fshost3:1/,
|
| // host1 -> localstorage -> http://host1:1/,
|
| - // host2 -> localstorage -> http://host2:2/.
|
| // host1 -> sessionstorage -> http://host1:1/,
|
| // host2 -> sessionstorage -> http://host2:2/,
|
| // idbhost1 -> sessionstorage -> http://idbhost1:1/,
|
| // idbhost2 -> sessionstorage -> http://idbhost2:2/.
|
| - EXPECT_EQ(33, cookies_model.GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ(42, cookies_model.GetRoot()->GetTotalNodeCount());
|
| EXPECT_STREQ("A,B,C,D", GetMonsterCookies(monster).c_str());
|
| EXPECT_STREQ("A,B,C,D", GetDisplayedCookies(&cookies_model).c_str());
|
| EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model));
|
| @@ -502,6 +675,8 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) {
|
| GetDisplayedSessionStorages(&cookies_model));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(&cookies_model));
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(&cookies_model));
|
| }
|
| DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2));
|
| {
|
| @@ -515,7 +690,9 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) {
|
| GetDisplayedSessionStorages(&cookies_model));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(&cookies_model));
|
| - EXPECT_EQ(29, cookies_model.GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(&cookies_model));
|
| + EXPECT_EQ(38, cookies_model.GetRoot()->GetTotalNodeCount());
|
| }
|
| }
|
|
|
| @@ -532,6 +709,7 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) {
|
| mock_browsing_data_session_storage_helper_,
|
| mock_browsing_data_appcache_helper_,
|
| mock_browsing_data_indexed_db_helper_,
|
| + mock_browsing_data_file_system_helper_,
|
| false);
|
| mock_browsing_data_database_helper_->AddDatabaseSamples();
|
| mock_browsing_data_database_helper_->Notify();
|
| @@ -541,20 +719,25 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) {
|
| mock_browsing_data_session_storage_helper_->Notify();
|
| mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples();
|
| mock_browsing_data_indexed_db_helper_->Notify();
|
| + mock_browsing_data_file_system_helper_->AddFileSystemSamples();
|
| + mock_browsing_data_file_system_helper_->Notify();
|
|
|
| {
|
| SCOPED_TRACE("Initial State 5 cookies, 2 databases, 2 local storages, "
|
| "2 session storages, 2 indexed DBs");
|
| - // 34 because there's the root, then foo1 -> cookies -> a,
|
| + // 43 because there's the root, then foo1 -> cookies -> a,
|
| // foo2 -> cookies -> b, foo3 -> cookies -> c,d,e
|
| // dbhost1 -> database -> db1, dbhost2 -> database -> db2,
|
| + // fshost1 -> filesystem -> http://fshost1:1/,
|
| + // fshost2 -> filesystem -> http://fshost2:1/,
|
| + // fshost3 -> filesystem -> http://fshost3:1/,
|
| // host1 -> localstorage -> http://host1:1/,
|
| - // host2 -> localstorage -> http://host2:2/.
|
| + // host2 -> localstorage -> http://host2:2/,
|
| // host1 -> sessionstorage -> http://host1:1/,
|
| // host2 -> sessionstorage -> http://host2:2/,
|
| // idbhost1 -> sessionstorage -> http://idbhost1:1/,
|
| // idbhost2 -> sessionstorage -> http://idbhost2:2/.
|
| - EXPECT_EQ(34, cookies_model.GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ(43, cookies_model.GetRoot()->GetTotalNodeCount());
|
| EXPECT_STREQ("A,B,C,D,E", GetMonsterCookies(monster).c_str());
|
| EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str());
|
| EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model));
|
| @@ -564,6 +747,8 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) {
|
| GetDisplayedSessionStorages(&cookies_model));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(&cookies_model));
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(&cookies_model));
|
| }
|
| DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)->GetChild(0)->
|
| GetChild(1));
|
| @@ -571,7 +756,7 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) {
|
| SCOPED_TRACE("Middle cookie in third origin removed");
|
| EXPECT_STREQ("A,B,C,E", GetMonsterCookies(monster).c_str());
|
| EXPECT_STREQ("A,B,C,E", GetDisplayedCookies(&cookies_model).c_str());
|
| - EXPECT_EQ(33, cookies_model.GetRoot()->GetTotalNodeCount());
|
| + EXPECT_EQ(42, cookies_model.GetRoot()->GetTotalNodeCount());
|
| EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model));
|
| EXPECT_EQ("http://host1:1/,http://host2:2/",
|
| GetDisplayedLocalStorages(&cookies_model));
|
| @@ -579,6 +764,8 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) {
|
| GetDisplayedSessionStorages(&cookies_model));
|
| EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
|
| GetDisplayedIndexedDBs(&cookies_model));
|
| + EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
|
| + GetDisplayedFileSystems(&cookies_model));
|
| }
|
| }
|
|
|
| @@ -595,6 +782,7 @@ TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) {
|
| mock_browsing_data_session_storage_helper_,
|
| mock_browsing_data_appcache_helper_,
|
| mock_browsing_data_indexed_db_helper_,
|
| + mock_browsing_data_file_system_helper_,
|
| false);
|
| {
|
| SCOPED_TRACE("Initial State 5 cookies");
|
| @@ -632,6 +820,7 @@ TEST_F(CookiesTreeModelTest, OriginOrdering) {
|
| new MockBrowsingDataLocalStorageHelper(profile_.get()),
|
| new MockBrowsingDataAppCacheHelper(profile_.get()),
|
| new MockBrowsingDataIndexedDBHelper(profile_.get()),
|
| + new MockBrowsingDataFileSystemHelper(profile_.get()),
|
| false);
|
|
|
| {
|
| @@ -662,6 +851,7 @@ TEST_F(CookiesTreeModelTest, ContentSettings) {
|
| new MockBrowsingDataLocalStorageHelper(profile_.get()),
|
| new MockBrowsingDataAppCacheHelper(profile_.get()),
|
| new MockBrowsingDataIndexedDBHelper(profile_.get()),
|
| + new MockBrowsingDataFileSystemHelper(profile_.get()),
|
| false);
|
|
|
| TestingProfile profile;
|
|
|