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

Side by Side Diff: chrome/browser/browsing_data/cookies_tree_model_unittest.cc

Issue 2110483002: Remove use of CanonicalCookie::Source() from browsing_data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Really really fix android? Created 4 years, 5 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 "chrome/browser/browsing_data/cookies_tree_model.h" 5 #include "chrome/browser/browsing_data/cookies_tree_model.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 mock_browsing_data_appcache_helper_.get(), 118 mock_browsing_data_appcache_helper_.get(),
119 mock_browsing_data_indexed_db_helper_.get(), 119 mock_browsing_data_indexed_db_helper_.get(),
120 mock_browsing_data_file_system_helper_.get(), 120 mock_browsing_data_file_system_helper_.get(),
121 mock_browsing_data_quota_helper_.get(), 121 mock_browsing_data_quota_helper_.get(),
122 mock_browsing_data_channel_id_helper_.get(), 122 mock_browsing_data_channel_id_helper_.get(),
123 mock_browsing_data_service_worker_helper_.get(), 123 mock_browsing_data_service_worker_helper_.get(),
124 mock_browsing_data_cache_storage_helper_.get(), 124 mock_browsing_data_cache_storage_helper_.get(),
125 mock_browsing_data_flash_lso_helper_.get()); 125 mock_browsing_data_flash_lso_helper_.get());
126 126
127 CookiesTreeModel* cookies_model = 127 CookiesTreeModel* cookies_model =
128 new CookiesTreeModel(container, special_storage_policy(), false); 128 new CookiesTreeModel(container, special_storage_policy());
129 mock_browsing_data_cookie_helper_-> 129 mock_browsing_data_cookie_helper_->
130 AddCookieSamples(GURL("http://foo1"), "A=1"); 130 AddCookieSamples(GURL("http://foo1"), "A=1");
131 mock_browsing_data_cookie_helper_-> 131 mock_browsing_data_cookie_helper_->
132 AddCookieSamples(GURL("http://foo2"), "B=1"); 132 AddCookieSamples(GURL("http://foo2"), "B=1");
133 mock_browsing_data_cookie_helper_-> 133 mock_browsing_data_cookie_helper_->
134 AddCookieSamples(GURL("http://foo3"), "C=1"); 134 AddCookieSamples(GURL("http://foo3"), "C=1");
135 mock_browsing_data_cookie_helper_->Notify(); 135 mock_browsing_data_cookie_helper_->Notify();
136 mock_browsing_data_database_helper_->AddDatabaseSamples(); 136 mock_browsing_data_database_helper_->AddDatabaseSamples();
137 mock_browsing_data_database_helper_->Notify(); 137 mock_browsing_data_database_helper_->Notify();
138 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); 138 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 mock_browsing_data_local_storage_helper_.get(), 1093 mock_browsing_data_local_storage_helper_.get(),
1094 mock_browsing_data_session_storage_helper_.get(), 1094 mock_browsing_data_session_storage_helper_.get(),
1095 mock_browsing_data_appcache_helper_.get(), 1095 mock_browsing_data_appcache_helper_.get(),
1096 mock_browsing_data_indexed_db_helper_.get(), 1096 mock_browsing_data_indexed_db_helper_.get(),
1097 mock_browsing_data_file_system_helper_.get(), 1097 mock_browsing_data_file_system_helper_.get(),
1098 mock_browsing_data_quota_helper_.get(), 1098 mock_browsing_data_quota_helper_.get(),
1099 mock_browsing_data_channel_id_helper_.get(), 1099 mock_browsing_data_channel_id_helper_.get(),
1100 mock_browsing_data_service_worker_helper_.get(), 1100 mock_browsing_data_service_worker_helper_.get(),
1101 mock_browsing_data_cache_storage_helper_.get(), 1101 mock_browsing_data_cache_storage_helper_.get(),
1102 mock_browsing_data_flash_lso_helper_.get()); 1102 mock_browsing_data_flash_lso_helper_.get());
1103 CookiesTreeModel cookies_model(container, special_storage_policy(), false); 1103 CookiesTreeModel cookies_model(container, special_storage_policy());
1104 1104
1105 mock_browsing_data_cookie_helper_-> 1105 mock_browsing_data_cookie_helper_->
1106 AddCookieSamples(GURL("http://foo1"), "A=1"); 1106 AddCookieSamples(GURL("http://foo1"), "A=1");
1107 mock_browsing_data_cookie_helper_-> 1107 mock_browsing_data_cookie_helper_->
1108 AddCookieSamples(GURL("http://foo2"), "B=1"); 1108 AddCookieSamples(GURL("http://foo2"), "B=1");
1109 mock_browsing_data_cookie_helper_-> 1109 mock_browsing_data_cookie_helper_->
1110 AddCookieSamples(GURL("http://foo3"), "C=1"); 1110 AddCookieSamples(GURL("http://foo3"), "C=1");
1111 mock_browsing_data_cookie_helper_-> 1111 mock_browsing_data_cookie_helper_->
1112 AddCookieSamples(GURL("http://foo3"), "D=1"); 1112 AddCookieSamples(GURL("http://foo3"), "D=1");
1113 mock_browsing_data_cookie_helper_->Notify(); 1113 mock_browsing_data_cookie_helper_->Notify();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 mock_browsing_data_local_storage_helper_.get(), 1200 mock_browsing_data_local_storage_helper_.get(),
1201 mock_browsing_data_session_storage_helper_.get(), 1201 mock_browsing_data_session_storage_helper_.get(),
1202 mock_browsing_data_appcache_helper_.get(), 1202 mock_browsing_data_appcache_helper_.get(),
1203 mock_browsing_data_indexed_db_helper_.get(), 1203 mock_browsing_data_indexed_db_helper_.get(),
1204 mock_browsing_data_file_system_helper_.get(), 1204 mock_browsing_data_file_system_helper_.get(),
1205 mock_browsing_data_quota_helper_.get(), 1205 mock_browsing_data_quota_helper_.get(),
1206 mock_browsing_data_channel_id_helper_.get(), 1206 mock_browsing_data_channel_id_helper_.get(),
1207 mock_browsing_data_service_worker_helper_.get(), 1207 mock_browsing_data_service_worker_helper_.get(),
1208 mock_browsing_data_cache_storage_helper_.get(), 1208 mock_browsing_data_cache_storage_helper_.get(),
1209 mock_browsing_data_flash_lso_helper_.get()); 1209 mock_browsing_data_flash_lso_helper_.get());
1210 CookiesTreeModel cookies_model(container, special_storage_policy(), false); 1210 CookiesTreeModel cookies_model(container, special_storage_policy());
1211 1211
1212 mock_browsing_data_cookie_helper_-> 1212 mock_browsing_data_cookie_helper_->
1213 AddCookieSamples(GURL("http://foo1"), "A=1"); 1213 AddCookieSamples(GURL("http://foo1"), "A=1");
1214 mock_browsing_data_cookie_helper_-> 1214 mock_browsing_data_cookie_helper_->
1215 AddCookieSamples(GURL("http://foo2"), "B=1"); 1215 AddCookieSamples(GURL("http://foo2"), "B=1");
1216 mock_browsing_data_cookie_helper_-> 1216 mock_browsing_data_cookie_helper_->
1217 AddCookieSamples(GURL("http://foo3"), "C=1"); 1217 AddCookieSamples(GURL("http://foo3"), "C=1");
1218 mock_browsing_data_cookie_helper_-> 1218 mock_browsing_data_cookie_helper_->
1219 AddCookieSamples(GURL("http://foo3"), "D=1"); 1219 AddCookieSamples(GURL("http://foo3"), "D=1");
1220 mock_browsing_data_cookie_helper_-> 1220 mock_browsing_data_cookie_helper_->
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 mock_browsing_data_local_storage_helper_.get(), 1310 mock_browsing_data_local_storage_helper_.get(),
1311 mock_browsing_data_session_storage_helper_.get(), 1311 mock_browsing_data_session_storage_helper_.get(),
1312 mock_browsing_data_appcache_helper_.get(), 1312 mock_browsing_data_appcache_helper_.get(),
1313 mock_browsing_data_indexed_db_helper_.get(), 1313 mock_browsing_data_indexed_db_helper_.get(),
1314 mock_browsing_data_file_system_helper_.get(), 1314 mock_browsing_data_file_system_helper_.get(),
1315 mock_browsing_data_quota_helper_.get(), 1315 mock_browsing_data_quota_helper_.get(),
1316 mock_browsing_data_channel_id_helper_.get(), 1316 mock_browsing_data_channel_id_helper_.get(),
1317 mock_browsing_data_service_worker_helper_.get(), 1317 mock_browsing_data_service_worker_helper_.get(),
1318 mock_browsing_data_cache_storage_helper_.get(), 1318 mock_browsing_data_cache_storage_helper_.get(),
1319 mock_browsing_data_flash_lso_helper_.get()); 1319 mock_browsing_data_flash_lso_helper_.get());
1320 CookiesTreeModel cookies_model(container, special_storage_policy(), false); 1320 CookiesTreeModel cookies_model(container, special_storage_policy());
1321 1321
1322 mock_browsing_data_cookie_helper_-> 1322 mock_browsing_data_cookie_helper_->
1323 AddCookieSamples(GURL("http://foo1"), "A=1"); 1323 AddCookieSamples(GURL("http://foo1"), "A=1");
1324 mock_browsing_data_cookie_helper_-> 1324 mock_browsing_data_cookie_helper_->
1325 AddCookieSamples(GURL("http://foo2"), "B=1"); 1325 AddCookieSamples(GURL("http://foo2"), "B=1");
1326 mock_browsing_data_cookie_helper_-> 1326 mock_browsing_data_cookie_helper_->
1327 AddCookieSamples(GURL("http://foo3"), "C=1"); 1327 AddCookieSamples(GURL("http://foo3"), "C=1");
1328 mock_browsing_data_cookie_helper_-> 1328 mock_browsing_data_cookie_helper_->
1329 AddCookieSamples(GURL("http://foo3"), "D=1"); 1329 AddCookieSamples(GURL("http://foo3"), "D=1");
1330 mock_browsing_data_cookie_helper_-> 1330 mock_browsing_data_cookie_helper_->
(...skipping 23 matching lines...) Expand all
1354 mock_browsing_data_local_storage_helper_.get(), 1354 mock_browsing_data_local_storage_helper_.get(),
1355 mock_browsing_data_session_storage_helper_.get(), 1355 mock_browsing_data_session_storage_helper_.get(),
1356 mock_browsing_data_appcache_helper_.get(), 1356 mock_browsing_data_appcache_helper_.get(),
1357 mock_browsing_data_indexed_db_helper_.get(), 1357 mock_browsing_data_indexed_db_helper_.get(),
1358 mock_browsing_data_file_system_helper_.get(), 1358 mock_browsing_data_file_system_helper_.get(),
1359 mock_browsing_data_quota_helper_.get(), 1359 mock_browsing_data_quota_helper_.get(),
1360 mock_browsing_data_channel_id_helper_.get(), 1360 mock_browsing_data_channel_id_helper_.get(),
1361 mock_browsing_data_service_worker_helper_.get(), 1361 mock_browsing_data_service_worker_helper_.get(),
1362 mock_browsing_data_cache_storage_helper_.get(), 1362 mock_browsing_data_cache_storage_helper_.get(),
1363 mock_browsing_data_flash_lso_helper_.get()); 1363 mock_browsing_data_flash_lso_helper_.get());
1364 CookiesTreeModel cookies_model(container, special_storage_policy(), false); 1364 CookiesTreeModel cookies_model(container, special_storage_policy());
1365 1365
1366 mock_browsing_data_cookie_helper_-> 1366 mock_browsing_data_cookie_helper_->
1367 AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); 1367 AddCookieSamples(GURL("http://a.foo2.com"), "A=1");
1368 mock_browsing_data_cookie_helper_-> 1368 mock_browsing_data_cookie_helper_->
1369 AddCookieSamples(GURL("http://foo2.com"), "B=1"); 1369 AddCookieSamples(GURL("http://foo2.com"), "B=1");
1370 mock_browsing_data_cookie_helper_-> 1370 mock_browsing_data_cookie_helper_->
1371 AddCookieSamples(GURL("http://b.foo1.com"), "C=1"); 1371 AddCookieSamples(GURL("http://b.foo1.com"), "C=1");
1372 // Leading dot on the foo4 1372 // Leading dot on the foo4
1373 mock_browsing_data_cookie_helper_->AddCookieSamples( 1373 mock_browsing_data_cookie_helper_->AddCookieSamples(
1374 GURL("http://foo4.com"), "D=1; domain=.foo4.com; path=/;"); 1374 GURL("http://foo4.com"), "D=1; domain=.foo4.com; path=/;");
(...skipping 28 matching lines...) Expand all
1403 mock_browsing_data_local_storage_helper_.get(), 1403 mock_browsing_data_local_storage_helper_.get(),
1404 mock_browsing_data_session_storage_helper_.get(), 1404 mock_browsing_data_session_storage_helper_.get(),
1405 mock_browsing_data_appcache_helper_.get(), 1405 mock_browsing_data_appcache_helper_.get(),
1406 mock_browsing_data_indexed_db_helper_.get(), 1406 mock_browsing_data_indexed_db_helper_.get(),
1407 mock_browsing_data_file_system_helper_.get(), 1407 mock_browsing_data_file_system_helper_.get(),
1408 mock_browsing_data_quota_helper_.get(), 1408 mock_browsing_data_quota_helper_.get(),
1409 mock_browsing_data_channel_id_helper_.get(), 1409 mock_browsing_data_channel_id_helper_.get(),
1410 mock_browsing_data_service_worker_helper_.get(), 1410 mock_browsing_data_service_worker_helper_.get(),
1411 mock_browsing_data_cache_storage_helper_.get(), 1411 mock_browsing_data_cache_storage_helper_.get(),
1412 mock_browsing_data_flash_lso_helper_.get()); 1412 mock_browsing_data_flash_lso_helper_.get());
1413 CookiesTreeModel cookies_model(container, special_storage_policy(), false); 1413 CookiesTreeModel cookies_model(container, special_storage_policy());
1414 1414
1415 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); 1415 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1");
1416 mock_browsing_data_cookie_helper_->Notify(); 1416 mock_browsing_data_cookie_helper_->Notify();
1417 1417
1418 TestingProfile profile; 1418 TestingProfile profile;
1419 HostContentSettingsMap* content_settings = 1419 HostContentSettingsMap* content_settings =
1420 HostContentSettingsMapFactory::GetForProfile(&profile); 1420 HostContentSettingsMapFactory::GetForProfile(&profile);
1421 content_settings::CookieSettings* cookie_settings = 1421 content_settings::CookieSettings* cookie_settings =
1422 CookieSettingsFactory::GetForProfile(&profile).get(); 1422 CookieSettingsFactory::GetForProfile(&profile).get();
1423 MockSettingsObserver observer(content_settings); 1423 MockSettingsObserver observer(content_settings);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 mock_browsing_data_local_storage_helper_.get(), 1508 mock_browsing_data_local_storage_helper_.get(),
1509 mock_browsing_data_session_storage_helper_.get(), 1509 mock_browsing_data_session_storage_helper_.get(),
1510 mock_browsing_data_appcache_helper_.get(), 1510 mock_browsing_data_appcache_helper_.get(),
1511 mock_browsing_data_indexed_db_helper_.get(), 1511 mock_browsing_data_indexed_db_helper_.get(),
1512 mock_browsing_data_file_system_helper_.get(), 1512 mock_browsing_data_file_system_helper_.get(),
1513 mock_browsing_data_quota_helper_.get(), 1513 mock_browsing_data_quota_helper_.get(),
1514 mock_browsing_data_channel_id_helper_.get(), 1514 mock_browsing_data_channel_id_helper_.get(),
1515 mock_browsing_data_service_worker_helper_.get(), 1515 mock_browsing_data_service_worker_helper_.get(),
1516 mock_browsing_data_cache_storage_helper_.get(), 1516 mock_browsing_data_cache_storage_helper_.get(),
1517 mock_browsing_data_flash_lso_helper_.get()); 1517 mock_browsing_data_flash_lso_helper_.get());
1518 CookiesTreeModel cookies_model(container, special_storage_policy(), false); 1518 CookiesTreeModel cookies_model(container, special_storage_policy());
1519 1519
1520 mock_browsing_data_cookie_helper_-> 1520 mock_browsing_data_cookie_helper_->
1521 AddCookieSamples(GURL("http://123.com"), "A=1"); 1521 AddCookieSamples(GURL("http://123.com"), "A=1");
1522 mock_browsing_data_cookie_helper_-> 1522 mock_browsing_data_cookie_helper_->
1523 AddCookieSamples(GURL("http://foo1.com"), "B=1"); 1523 AddCookieSamples(GURL("http://foo1.com"), "B=1");
1524 mock_browsing_data_cookie_helper_-> 1524 mock_browsing_data_cookie_helper_->
1525 AddCookieSamples(GURL("http://foo2.com"), "C=1"); 1525 AddCookieSamples(GURL("http://foo2.com"), "C=1");
1526 mock_browsing_data_cookie_helper_-> 1526 mock_browsing_data_cookie_helper_->
1527 AddCookieSamples(GURL("http://foo3.com"), "D=1"); 1527 AddCookieSamples(GURL("http://foo3.com"), "D=1");
1528 mock_browsing_data_cookie_helper_->Notify(); 1528 mock_browsing_data_cookie_helper_->Notify();
(...skipping 21 matching lines...) Expand all
1550 mock_browsing_data_local_storage_helper_.get(), 1550 mock_browsing_data_local_storage_helper_.get(),
1551 mock_browsing_data_session_storage_helper_.get(), 1551 mock_browsing_data_session_storage_helper_.get(),
1552 mock_browsing_data_appcache_helper_.get(), 1552 mock_browsing_data_appcache_helper_.get(),
1553 mock_browsing_data_indexed_db_helper_.get(), 1553 mock_browsing_data_indexed_db_helper_.get(),
1554 mock_browsing_data_file_system_helper_.get(), 1554 mock_browsing_data_file_system_helper_.get(),
1555 mock_browsing_data_quota_helper_.get(), 1555 mock_browsing_data_quota_helper_.get(),
1556 mock_browsing_data_channel_id_helper_.get(), 1556 mock_browsing_data_channel_id_helper_.get(),
1557 mock_browsing_data_service_worker_helper_.get(), 1557 mock_browsing_data_service_worker_helper_.get(),
1558 mock_browsing_data_cache_storage_helper_.get(), 1558 mock_browsing_data_cache_storage_helper_.get(),
1559 mock_browsing_data_flash_lso_helper_.get()); 1559 mock_browsing_data_flash_lso_helper_.get());
1560 CookiesTreeModel cookies_model(container, special_storage_policy(), 1560 CookiesTreeModel cookies_model(container, special_storage_policy());
1561 true /* group by cookie source */);
1562 1561
1563 mock_browsing_data_cookie_helper_->AddCookieSamples( 1562 mock_browsing_data_cookie_helper_->AddCookieSamples(
1564 GURL("file:///tmp/test.html"), "A=1"); 1563 GURL("file:///tmp/test.html"), "A=1");
1565 mock_browsing_data_cookie_helper_->AddCookieSamples( 1564 mock_browsing_data_cookie_helper_->AddCookieSamples(
1566 GURL("http://example.com"), "B=1"); 1565 GURL("http://example.com"), "B=1");
1567 mock_browsing_data_cookie_helper_->AddCookieSamples( 1566 mock_browsing_data_cookie_helper_->AddCookieSamples(
1568 GURL("http://example.com/"), "C=1"); 1567 GURL("http://example.com/"), "C=1");
1569 mock_browsing_data_cookie_helper_->AddCookieSamples( 1568 mock_browsing_data_cookie_helper_->AddCookieSamples(
1570 GURL("http://example.com/test"), "D=1"); 1569 GURL("http://example.com/test"), "D=1");
1571 mock_browsing_data_cookie_helper_->AddCookieSamples( 1570 mock_browsing_data_cookie_helper_->AddCookieSamples(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 mock_browsing_data_local_storage_helper_.get(), 1638 mock_browsing_data_local_storage_helper_.get(),
1640 mock_browsing_data_session_storage_helper_.get(), 1639 mock_browsing_data_session_storage_helper_.get(),
1641 mock_browsing_data_appcache_helper_.get(), 1640 mock_browsing_data_appcache_helper_.get(),
1642 mock_browsing_data_indexed_db_helper_.get(), 1641 mock_browsing_data_indexed_db_helper_.get(),
1643 mock_browsing_data_file_system_helper_.get(), 1642 mock_browsing_data_file_system_helper_.get(),
1644 mock_browsing_data_quota_helper_.get(), 1643 mock_browsing_data_quota_helper_.get(),
1645 mock_browsing_data_channel_id_helper_.get(), 1644 mock_browsing_data_channel_id_helper_.get(),
1646 mock_browsing_data_service_worker_helper_.get(), 1645 mock_browsing_data_service_worker_helper_.get(),
1647 mock_browsing_data_cache_storage_helper_.get(), 1646 mock_browsing_data_cache_storage_helper_.get(),
1648 mock_browsing_data_flash_lso_helper_.get()); 1647 mock_browsing_data_flash_lso_helper_.get());
1649 CookiesTreeModel cookies_model(container, special_storage_policy(), false); 1648 CookiesTreeModel cookies_model(container, special_storage_policy());
1650 1649
1651 mock_browsing_data_cookie_helper_-> 1650 mock_browsing_data_cookie_helper_->
1652 AddCookieSamples(GURL(), "A=1"); 1651 AddCookieSamples(GURL(), "A=1");
1653 mock_browsing_data_cookie_helper_->Notify(); 1652 mock_browsing_data_cookie_helper_->Notify();
1654 EXPECT_EQ("A", GetDisplayedCookies(&cookies_model)); 1653 EXPECT_EQ("A", GetDisplayedCookies(&cookies_model));
1655 } 1654 }
1656 1655
1657 } // namespace 1656 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698