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

Side by Side Diff: chrome/browser/gtk/options/cookies_view_unittest.cc

Issue 3048002: Store creating url in origin nodes and use it for content settings. (Closed)
Patch Set: compilefix Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/gtk/options/cookies_view.h" 5 #include "chrome/browser/gtk/options/cookies_view.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include <gtk/gtk.h> 10 #include <gtk/gtk.h>
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 cookies_view.TestDestroySyncrhonously(); 226 cookies_view.TestDestroySyncrhonously();
227 mock_browsing_data_database_helper_->AddDatabaseSamples(); 227 mock_browsing_data_database_helper_->AddDatabaseSamples();
228 mock_browsing_data_database_helper_->Notify(); 228 mock_browsing_data_database_helper_->Notify();
229 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); 229 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
230 mock_browsing_data_local_storage_helper_->Notify(); 230 mock_browsing_data_local_storage_helper_->Notify();
231 EXPECT_STREQ("foo0,_Cookies,__C,__D," 231 EXPECT_STREQ("foo0,_Cookies,__C,__D,"
232 "foo1,_Cookies,__A,__B,__E," 232 "foo1,_Cookies,__A,__B,__E,"
233 "foo2,_Cookies,__G,__X," 233 "foo2,_Cookies,__G,__X,"
234 "gdbhost1,_Web Databases,__db1," 234 "gdbhost1,_Web Databases,__db1,"
235 "gdbhost2,_Web Databases,__db2," 235 "gdbhost2,_Web Databases,__db2,"
236 "host1,_Local Storage,__origin1," 236 "host1,_Local Storage,__http://host1:1/,"
237 "host2,_Local Storage,__origin2", 237 "host2,_Local Storage,__http://host2:2/",
238 GetDisplayedCookies(cookies_view).c_str()); 238 GetDisplayedCookies(cookies_view).c_str());
239 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 239 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
240 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 240 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
241 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view); 241 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
242 } 242 }
243 243
244 TEST_F(CookiesViewTest, RemoveAll) { 244 TEST_F(CookiesViewTest, RemoveAll) {
245 net::CookieMonster* monster = profile_->GetCookieMonster(); 245 net::CookieMonster* monster = profile_->GetCookieMonster();
246 monster->SetCookie(GURL("http://foo"), "A=1"); 246 monster->SetCookie(GURL("http://foo"), "A=1");
247 monster->SetCookie(GURL("http://foo2"), "B=1"); 247 monster->SetCookie(GURL("http://foo2"), "B=1");
(...skipping 12 matching lines...) Expand all
260 gtk_tree_selection_unselect_all(cookies_view.selection_); 260 gtk_tree_selection_unselect_all(cookies_view.selection_);
261 261
262 { 262 {
263 SCOPED_TRACE("Before removing"); 263 SCOPED_TRACE("Before removing");
264 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 264 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
265 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 265 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
266 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view); 266 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
267 EXPECT_STREQ("foo,_Cookies,__A,foo2,_Cookies,__B," 267 EXPECT_STREQ("foo,_Cookies,__A,foo2,_Cookies,__B,"
268 "gdbhost1,_Web Databases,__db1," 268 "gdbhost1,_Web Databases,__db1,"
269 "gdbhost2,_Web Databases,__db2," 269 "gdbhost2,_Web Databases,__db2,"
270 "host1,_Local Storage,__origin1," 270 "host1,_Local Storage,__http://host1:1/,"
271 "host2,_Local Storage,__origin2", 271 "host2,_Local Storage,__http://host2:2/",
272 GetDisplayedCookies(cookies_view).c_str()); 272 GetDisplayedCookies(cookies_view).c_str());
273 } 273 }
274 274
275 mock_browsing_data_database_helper_->Reset(); 275 mock_browsing_data_database_helper_->Reset();
276 mock_browsing_data_local_storage_helper_->Reset(); 276 mock_browsing_data_local_storage_helper_->Reset();
277 277
278 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_all_button_)); 278 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_all_button_));
279 { 279 {
280 SCOPED_TRACE("After removing"); 280 SCOPED_TRACE("After removing");
281 EXPECT_EQ(0u, monster->GetAllCookies().size()); 281 EXPECT_EQ(0u, monster->GetAllCookies().size());
(...skipping 24 matching lines...) Expand all
306 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str()); 306 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str());
307 EXPECT_EQ(1, gtk_tree_selection_count_selected_rows(cookies_view.selection_)); 307 EXPECT_EQ(1, gtk_tree_selection_count_selected_rows(cookies_view.selection_));
308 { 308 {
309 SCOPED_TRACE("Before removing"); 309 SCOPED_TRACE("Before removing");
310 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 310 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
311 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 311 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
312 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view); 312 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
313 EXPECT_STREQ("foo,_Cookies,__A,foo2,_Cookies,__B," 313 EXPECT_STREQ("foo,_Cookies,__A,foo2,_Cookies,__B,"
314 "gdbhost1,_Web Databases,__db1," 314 "gdbhost1,_Web Databases,__db1,"
315 "gdbhost2,_Web Databases,__db2," 315 "gdbhost2,_Web Databases,__db2,"
316 "host1,_Local Storage,__origin1," 316 "host1,_Local Storage,__http://host1:1/,"
317 "host2,_Local Storage,__origin2", 317 "host2,_Local Storage,__http://host2:2/",
318 GetDisplayedCookies(cookies_view).c_str()); 318 GetDisplayedCookies(cookies_view).c_str());
319 } 319 }
320 320
321 mock_browsing_data_database_helper_->Reset(); 321 mock_browsing_data_database_helper_->Reset();
322 mock_browsing_data_local_storage_helper_->Reset(); 322 mock_browsing_data_local_storage_helper_->Reset();
323 323
324 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_all_button_)); 324 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_all_button_));
325 { 325 {
326 SCOPED_TRACE("After removing"); 326 SCOPED_TRACE("After removing");
327 EXPECT_EQ(0u, monster->GetAllCookies().size()); 327 EXPECT_EQ(0u, monster->GetAllCookies().size());
(...skipping 28 matching lines...) Expand all
356 ASSERT_TRUE(SelectByPath(cookies_view, "1:0:0")); 356 ASSERT_TRUE(SelectByPath(cookies_view, "1:0:0"));
357 357
358 { 358 {
359 SCOPED_TRACE("First selection"); 359 SCOPED_TRACE("First selection");
360 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 360 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
361 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 361 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
362 CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view); 362 CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view);
363 EXPECT_STREQ("foo1,_Cookies,__A,foo2,+Cookies,++B,++C," 363 EXPECT_STREQ("foo1,_Cookies,__A,foo2,+Cookies,++B,++C,"
364 "gdbhost1,_Web Databases,__db1," 364 "gdbhost1,_Web Databases,__db1,"
365 "gdbhost2,_Web Databases,__db2," 365 "gdbhost2,_Web Databases,__db2,"
366 "host1,_Local Storage,__origin1," 366 "host1,_Local Storage,__http://host1:1/,"
367 "host2,_Local Storage,__origin2", 367 "host2,_Local Storage,__http://host2:2/",
368 GetDisplayedCookies(cookies_view).c_str()); 368 GetDisplayedCookies(cookies_view).c_str());
369 } 369 }
370 370
371 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 371 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
372 372
373 { 373 {
374 SCOPED_TRACE("First selection removed"); 374 SCOPED_TRACE("First selection removed");
375 EXPECT_STREQ("A,C", GetMonsterCookies(monster).c_str()); 375 EXPECT_STREQ("A,C", GetMonsterCookies(monster).c_str());
376 EXPECT_STREQ("foo1,_Cookies,__A,foo2,+Cookies,++C," 376 EXPECT_STREQ("foo1,_Cookies,__A,foo2,+Cookies,++C,"
377 "gdbhost1,_Web Databases,__db1," 377 "gdbhost1,_Web Databases,__db1,"
378 "gdbhost2,_Web Databases,__db2," 378 "gdbhost2,_Web Databases,__db2,"
379 "host1,_Local Storage,__origin1," 379 "host1,_Local Storage,__http://host1:1/,"
380 "host2,_Local Storage,__origin2", 380 "host2,_Local Storage,__http://host2:2/",
381 GetDisplayedCookies(cookies_view).c_str()); 381 GetDisplayedCookies(cookies_view).c_str());
382 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 382 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
383 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 383 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
384 EXPECT_STREQ("1:0:0", GetSelectedPath(cookies_view).c_str()); 384 EXPECT_STREQ("1:0:0", GetSelectedPath(cookies_view).c_str());
385 CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view); 385 CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view);
386 } 386 }
387 387
388 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 388 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
389 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 389 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
390 390
391 { 391 {
392 SCOPED_TRACE("Second selection"); 392 SCOPED_TRACE("Second selection");
393 EXPECT_STREQ("A", GetMonsterCookies(monster).c_str()); 393 EXPECT_STREQ("A", GetMonsterCookies(monster).c_str());
394 EXPECT_STREQ("foo1,_Cookies,__A," 394 EXPECT_STREQ("foo1,_Cookies,__A,"
395 "gdbhost1,_Web Databases,__db1," 395 "gdbhost1,_Web Databases,__db1,"
396 "gdbhost2,_Web Databases,__db2," 396 "gdbhost2,_Web Databases,__db2,"
397 "host1,_Local Storage,__origin1," 397 "host1,_Local Storage,__http://host1:1/,"
398 "host2,_Local Storage,__origin2", 398 "host2,_Local Storage,__http://host2:2/",
399 GetDisplayedCookies(cookies_view).c_str()); 399 GetDisplayedCookies(cookies_view).c_str());
400 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 400 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
401 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 401 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
402 EXPECT_STREQ("", GetSelectedPath(cookies_view).c_str()); 402 EXPECT_STREQ("", GetSelectedPath(cookies_view).c_str());
403 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view); 403 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
404 } 404 }
405 405
406 ASSERT_TRUE(ExpandByPath(cookies_view, "0")); 406 ASSERT_TRUE(ExpandByPath(cookies_view, "0"));
407 EXPECT_STREQ("foo1,+Cookies,++A," 407 EXPECT_STREQ("foo1,+Cookies,++A,"
408 "gdbhost1,_Web Databases,__db1," 408 "gdbhost1,_Web Databases,__db1,"
409 "gdbhost2,_Web Databases,__db2," 409 "gdbhost2,_Web Databases,__db2,"
410 "host1,_Local Storage,__origin1," 410 "host1,_Local Storage,__http://host1:1/,"
411 "host2,_Local Storage,__origin2", 411 "host2,_Local Storage,__http://host2:2/",
412 GetDisplayedCookies(cookies_view).c_str()); 412 GetDisplayedCookies(cookies_view).c_str());
413 ASSERT_TRUE(SelectByPath(cookies_view, "0:0:0")); 413 ASSERT_TRUE(SelectByPath(cookies_view, "0:0:0"));
414 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 414 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
415 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 415 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
416 416
417 { 417 {
418 SCOPED_TRACE("Second selection removed"); 418 SCOPED_TRACE("Second selection removed");
419 EXPECT_EQ(0u, monster->GetAllCookies().size()); 419 EXPECT_EQ(0u, monster->GetAllCookies().size());
420 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 420 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
421 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 421 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
422 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view); 422 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
423 EXPECT_STREQ("gdbhost1,_Web Databases,__db1," 423 EXPECT_STREQ("gdbhost1,_Web Databases,__db1,"
424 "gdbhost2,_Web Databases,__db2," 424 "gdbhost2,_Web Databases,__db2,"
425 "host1,_Local Storage,__origin1," 425 "host1,_Local Storage,__http://host1:1/,"
426 "host2,_Local Storage,__origin2", 426 "host2,_Local Storage,__http://host2:2/",
427 GetDisplayedCookies(cookies_view).c_str()); 427 GetDisplayedCookies(cookies_view).c_str());
428 } 428 }
429 429
430 ASSERT_TRUE(ExpandByPath(cookies_view, "0")); 430 ASSERT_TRUE(ExpandByPath(cookies_view, "0"));
431 EXPECT_STREQ("gdbhost1,+Web Databases,++db1," 431 EXPECT_STREQ("gdbhost1,+Web Databases,++db1,"
432 "gdbhost2,_Web Databases,__db2," 432 "gdbhost2,_Web Databases,__db2,"
433 "host1,_Local Storage,__origin1," 433 "host1,_Local Storage,__http://host1:1/,"
434 "host2,_Local Storage,__origin2", 434 "host2,_Local Storage,__http://host2:2/",
435 GetDisplayedCookies(cookies_view).c_str()); 435 GetDisplayedCookies(cookies_view).c_str());
436 ASSERT_TRUE(SelectByPath(cookies_view, "0:0:0")); 436 ASSERT_TRUE(SelectByPath(cookies_view, "0:0:0"));
437 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 437 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
438 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 438 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
439 439
440 { 440 {
441 SCOPED_TRACE("Third selection removed"); 441 SCOPED_TRACE("Third selection removed");
442 EXPECT_EQ(0u, monster->GetAllCookies().size()); 442 EXPECT_EQ(0u, monster->GetAllCookies().size());
443 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 443 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
444 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 444 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
445 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view); 445 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
446 EXPECT_STREQ("gdbhost2,_Web Databases,__db2," 446 EXPECT_STREQ("gdbhost2,_Web Databases,__db2,"
447 "host1,_Local Storage,__origin1," 447 "host1,_Local Storage,__http://host1:1/,"
448 "host2,_Local Storage,__origin2", 448 "host2,_Local Storage,__http://host2:2/",
449 GetDisplayedCookies(cookies_view).c_str()); 449 GetDisplayedCookies(cookies_view).c_str());
450 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_origin_ == 450 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_origin_ ==
451 "http_gdbhost1_1"); 451 "http_gdbhost1_1");
452 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_db_ == 452 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_db_ ==
453 "db1"); 453 "db1");
454 } 454 }
455 455
456 ASSERT_TRUE(ExpandByPath(cookies_view, "1")); 456 ASSERT_TRUE(ExpandByPath(cookies_view, "1"));
457 EXPECT_STREQ("gdbhost2,_Web Databases,__db2," 457 EXPECT_STREQ("gdbhost2,_Web Databases,__db2,"
458 "host1,+Local Storage,++origin1," 458 "host1,+Local Storage,++http://host1:1/,"
459 "host2,_Local Storage,__origin2", 459 "host2,_Local Storage,__http://host2:2/",
460 GetDisplayedCookies(cookies_view).c_str()); 460 GetDisplayedCookies(cookies_view).c_str());
461 ASSERT_TRUE(SelectByPath(cookies_view, "1:0:0")); 461 ASSERT_TRUE(SelectByPath(cookies_view, "1:0:0"));
462 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 462 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
463 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 463 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
464 464
465 { 465 {
466 SCOPED_TRACE("Fourth selection removed"); 466 SCOPED_TRACE("Fourth selection removed");
467 EXPECT_EQ(0u, monster->GetAllCookies().size()); 467 EXPECT_EQ(0u, monster->GetAllCookies().size());
468 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 468 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
469 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 469 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
470 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view); 470 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
471 EXPECT_STREQ("gdbhost2,_Web Databases,__db2," 471 EXPECT_STREQ("gdbhost2,_Web Databases,__db2,"
472 "host2,_Local Storage,__origin2", 472 "host2,_Local Storage,__http://host2:2/",
473 GetDisplayedCookies(cookies_view).c_str()); 473 GetDisplayedCookies(cookies_view).c_str());
474 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->last_deleted_file_ == 474 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->last_deleted_file_ ==
475 FilePath(FILE_PATH_LITERAL("file1"))); 475 FilePath(FILE_PATH_LITERAL("file1")));
476 } 476 }
477 } 477 }
478 478
479 TEST_F(CookiesViewTest, RemoveCookiesByType) { 479 TEST_F(CookiesViewTest, RemoveCookiesByType) {
480 net::CookieMonster* monster = profile_->GetCookieMonster(); 480 net::CookieMonster* monster = profile_->GetCookieMonster();
481 monster->SetCookie(GURL("http://foo0"), "C=1"); 481 monster->SetCookie(GURL("http://foo0"), "C=1");
482 monster->SetCookie(GURL("http://foo0"), "D=1"); 482 monster->SetCookie(GURL("http://foo0"), "D=1");
(...skipping 11 matching lines...) Expand all
494 mock_browsing_data_database_helper_->AddDatabaseSamples(); 494 mock_browsing_data_database_helper_->AddDatabaseSamples();
495 mock_browsing_data_database_helper_->Notify(); 495 mock_browsing_data_database_helper_->Notify();
496 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); 496 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
497 mock_browsing_data_local_storage_helper_->Notify(); 497 mock_browsing_data_local_storage_helper_->Notify();
498 498
499 EXPECT_STREQ("foo0,_Cookies,__C,__D," 499 EXPECT_STREQ("foo0,_Cookies,__C,__D,"
500 "foo1,_Cookies,__A,__B,__E," 500 "foo1,_Cookies,__A,__B,__E,"
501 "foo2,_Cookies,__G,__X," 501 "foo2,_Cookies,__G,__X,"
502 "gdbhost1,_Web Databases,__db1," 502 "gdbhost1,_Web Databases,__db1,"
503 "gdbhost2,_Web Databases,__db2," 503 "gdbhost2,_Web Databases,__db2,"
504 "host1,_Local Storage,__origin1," 504 "host1,_Local Storage,__http://host1:1/,"
505 "host2,_Local Storage,__origin2", 505 "host2,_Local Storage,__http://host2:2/",
506 GetDisplayedCookies(cookies_view).c_str()); 506 GetDisplayedCookies(cookies_view).c_str());
507 507
508 ASSERT_TRUE(ExpandByPath(cookies_view, "1")); 508 ASSERT_TRUE(ExpandByPath(cookies_view, "1"));
509 EXPECT_STREQ("foo0,_Cookies,__C,__D," 509 EXPECT_STREQ("foo0,_Cookies,__C,__D,"
510 "foo1,+Cookies,++A,++B,++E," 510 "foo1,+Cookies,++A,++B,++E,"
511 "foo2,_Cookies,__G,__X," 511 "foo2,_Cookies,__G,__X,"
512 "gdbhost1,_Web Databases,__db1," 512 "gdbhost1,_Web Databases,__db1,"
513 "gdbhost2,_Web Databases,__db2," 513 "gdbhost2,_Web Databases,__db2,"
514 "host1,_Local Storage,__origin1," 514 "host1,_Local Storage,__http://host1:1/,"
515 "host2,_Local Storage,__origin2", 515 "host2,_Local Storage,__http://host2:2/",
516 GetDisplayedCookies(cookies_view).c_str()); 516 GetDisplayedCookies(cookies_view).c_str());
517 ASSERT_TRUE(SelectByPath(cookies_view, "1:0")); 517 ASSERT_TRUE(SelectByPath(cookies_view, "1:0"));
518 518
519 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 519 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
520 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 520 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
521 521
522 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 522 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
523 523
524 EXPECT_STREQ("C,D,G,X", GetMonsterCookies(monster).c_str()); 524 EXPECT_STREQ("C,D,G,X", GetMonsterCookies(monster).c_str());
525 EXPECT_STREQ("foo0,_Cookies,__C,__D," 525 EXPECT_STREQ("foo0,_Cookies,__C,__D,"
526 "foo2,_Cookies,__G,__X," 526 "foo2,_Cookies,__G,__X,"
527 "gdbhost1,_Web Databases,__db1," 527 "gdbhost1,_Web Databases,__db1,"
528 "gdbhost2,_Web Databases,__db2," 528 "gdbhost2,_Web Databases,__db2,"
529 "host1,_Local Storage,__origin1," 529 "host1,_Local Storage,__http://host1:1/,"
530 "host2,_Local Storage,__origin2", 530 "host2,_Local Storage,__http://host2:2/",
531 GetDisplayedCookies(cookies_view).c_str()); 531 GetDisplayedCookies(cookies_view).c_str());
532 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 532 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
533 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 533 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
534 534
535 ASSERT_TRUE(ExpandByPath(cookies_view, "0")); 535 ASSERT_TRUE(ExpandByPath(cookies_view, "0"));
536 EXPECT_STREQ("foo0,+Cookies,++C,++D," 536 EXPECT_STREQ("foo0,+Cookies,++C,++D,"
537 "foo2,_Cookies,__G,__X," 537 "foo2,_Cookies,__G,__X,"
538 "gdbhost1,_Web Databases,__db1," 538 "gdbhost1,_Web Databases,__db1,"
539 "gdbhost2,_Web Databases,__db2," 539 "gdbhost2,_Web Databases,__db2,"
540 "host1,_Local Storage,__origin1," 540 "host1,_Local Storage,__http://host1:1/,"
541 "host2,_Local Storage,__origin2", 541 "host2,_Local Storage,__http://host2:2/",
542 GetDisplayedCookies(cookies_view).c_str()); 542 GetDisplayedCookies(cookies_view).c_str());
543 ASSERT_TRUE(SelectByPath(cookies_view, "0:0")); 543 ASSERT_TRUE(SelectByPath(cookies_view, "0:0"));
544 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 544 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
545 545
546 EXPECT_STREQ("G,X", GetMonsterCookies(monster).c_str()); 546 EXPECT_STREQ("G,X", GetMonsterCookies(monster).c_str());
547 EXPECT_STREQ("foo2,_Cookies,__G,__X," 547 EXPECT_STREQ("foo2,_Cookies,__G,__X,"
548 "gdbhost1,_Web Databases,__db1," 548 "gdbhost1,_Web Databases,__db1,"
549 "gdbhost2,_Web Databases,__db2," 549 "gdbhost2,_Web Databases,__db2,"
550 "host1,_Local Storage,__origin1," 550 "host1,_Local Storage,__http://host1:1/,"
551 "host2,_Local Storage,__origin2", 551 "host2,_Local Storage,__http://host2:2/",
552 GetDisplayedCookies(cookies_view).c_str()); 552 GetDisplayedCookies(cookies_view).c_str());
553 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 553 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
554 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 554 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
555 555
556 ASSERT_TRUE(ExpandByPath(cookies_view, "0")); 556 ASSERT_TRUE(ExpandByPath(cookies_view, "0"));
557 EXPECT_STREQ("foo2,+Cookies,++G,++X," 557 EXPECT_STREQ("foo2,+Cookies,++G,++X,"
558 "gdbhost1,_Web Databases,__db1," 558 "gdbhost1,_Web Databases,__db1,"
559 "gdbhost2,_Web Databases,__db2," 559 "gdbhost2,_Web Databases,__db2,"
560 "host1,_Local Storage,__origin1," 560 "host1,_Local Storage,__http://host1:1/,"
561 "host2,_Local Storage,__origin2", 561 "host2,_Local Storage,__http://host2:2/",
562 GetDisplayedCookies(cookies_view).c_str()); 562 GetDisplayedCookies(cookies_view).c_str());
563 ASSERT_TRUE(SelectByPath(cookies_view, "0:0")); 563 ASSERT_TRUE(SelectByPath(cookies_view, "0:0"));
564 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 564 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
565 565
566 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 566 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
567 EXPECT_STREQ("gdbhost1,_Web Databases,__db1," 567 EXPECT_STREQ("gdbhost1,_Web Databases,__db1,"
568 "gdbhost2,_Web Databases,__db2," 568 "gdbhost2,_Web Databases,__db2,"
569 "host1,_Local Storage,__origin1," 569 "host1,_Local Storage,__http://host1:1/,"
570 "host2,_Local Storage,__origin2", 570 "host2,_Local Storage,__http://host2:2/",
571 GetDisplayedCookies(cookies_view).c_str()); 571 GetDisplayedCookies(cookies_view).c_str());
572 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 572 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
573 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 573 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
574 574
575 ASSERT_TRUE(ExpandByPath(cookies_view, "0")); 575 ASSERT_TRUE(ExpandByPath(cookies_view, "0"));
576 EXPECT_STREQ("gdbhost1,+Web Databases,++db1," 576 EXPECT_STREQ("gdbhost1,+Web Databases,++db1,"
577 "gdbhost2,_Web Databases,__db2," 577 "gdbhost2,_Web Databases,__db2,"
578 "host1,_Local Storage,__origin1," 578 "host1,_Local Storage,__http://host1:1/,"
579 "host2,_Local Storage,__origin2", 579 "host2,_Local Storage,__http://host2:2/",
580 GetDisplayedCookies(cookies_view).c_str()); 580 GetDisplayedCookies(cookies_view).c_str());
581 ASSERT_TRUE(SelectByPath(cookies_view, "0:0")); 581 ASSERT_TRUE(SelectByPath(cookies_view, "0:0"));
582 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 582 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
583 583
584 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 584 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
585 EXPECT_STREQ("gdbhost2,_Web Databases,__db2," 585 EXPECT_STREQ("gdbhost2,_Web Databases,__db2,"
586 "host1,_Local Storage,__origin1," 586 "host1,_Local Storage,__http://host1:1/,"
587 "host2,_Local Storage,__origin2", 587 "host2,_Local Storage,__http://host2:2/",
588 GetDisplayedCookies(cookies_view).c_str()); 588 GetDisplayedCookies(cookies_view).c_str());
589 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 589 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
590 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 590 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
591 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_origin_ == 591 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_origin_ ==
592 "http_gdbhost1_1"); 592 "http_gdbhost1_1");
593 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_db_ == 593 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_db_ ==
594 "db1"); 594 "db1");
595 595
596 ASSERT_TRUE(ExpandByPath(cookies_view, "1")); 596 ASSERT_TRUE(ExpandByPath(cookies_view, "1"));
597 EXPECT_STREQ("gdbhost2,_Web Databases,__db2," 597 EXPECT_STREQ("gdbhost2,_Web Databases,__db2,"
598 "host1,+Local Storage,++origin1," 598 "host1,+Local Storage,++http://host1:1/,"
599 "host2,_Local Storage,__origin2", 599 "host2,_Local Storage,__http://host2:2/",
600 GetDisplayedCookies(cookies_view).c_str()); 600 GetDisplayedCookies(cookies_view).c_str());
601 ASSERT_TRUE(SelectByPath(cookies_view, "1:0")); 601 ASSERT_TRUE(SelectByPath(cookies_view, "1:0"));
602 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 602 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
603 603
604 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 604 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
605 EXPECT_STREQ("gdbhost2,_Web Databases,__db2," 605 EXPECT_STREQ("gdbhost2,_Web Databases,__db2,"
606 "host2,_Local Storage,__origin2", 606 "host2,_Local Storage,__http://host2:2/",
607 GetDisplayedCookies(cookies_view).c_str()); 607 GetDisplayedCookies(cookies_view).c_str());
608 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 608 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
609 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 609 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
610 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->last_deleted_file_ == 610 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->last_deleted_file_ ==
611 FilePath(FILE_PATH_LITERAL("file1"))); 611 FilePath(FILE_PATH_LITERAL("file1")));
612 } 612 }
613 613
614 TEST_F(CookiesViewTest, RemoveByDomain) { 614 TEST_F(CookiesViewTest, RemoveByDomain) {
615 net::CookieMonster* monster = profile_->GetCookieMonster(); 615 net::CookieMonster* monster = profile_->GetCookieMonster();
616 monster->SetCookie(GURL("http://foo0"), "C=1"); 616 monster->SetCookie(GURL("http://foo0"), "C=1");
(...skipping 12 matching lines...) Expand all
629 mock_browsing_data_database_helper_->AddDatabaseSamples(); 629 mock_browsing_data_database_helper_->AddDatabaseSamples();
630 mock_browsing_data_database_helper_->Notify(); 630 mock_browsing_data_database_helper_->Notify();
631 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); 631 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
632 mock_browsing_data_local_storage_helper_->Notify(); 632 mock_browsing_data_local_storage_helper_->Notify();
633 633
634 EXPECT_STREQ("foo0,_Cookies,__C,__D," 634 EXPECT_STREQ("foo0,_Cookies,__C,__D,"
635 "foo1,_Cookies,__A,__B,__E," 635 "foo1,_Cookies,__A,__B,__E,"
636 "foo2,_Cookies,__G,__X," 636 "foo2,_Cookies,__G,__X,"
637 "gdbhost1,_Web Databases,__db1," 637 "gdbhost1,_Web Databases,__db1,"
638 "gdbhost2,_Web Databases,__db2," 638 "gdbhost2,_Web Databases,__db2,"
639 "host1,_Local Storage,__origin1," 639 "host1,_Local Storage,__http://host1:1/,"
640 "host2,_Local Storage,__origin2", 640 "host2,_Local Storage,__http://host2:2/",
641 GetDisplayedCookies(cookies_view).c_str()); 641 GetDisplayedCookies(cookies_view).c_str());
642 642
643 ASSERT_TRUE(SelectByPath(cookies_view, "1")); 643 ASSERT_TRUE(SelectByPath(cookies_view, "1"));
644 644
645 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 645 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
646 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 646 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
647 647
648 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 648 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
649 649
650 EXPECT_STREQ("C,D,G,X", GetMonsterCookies(monster).c_str()); 650 EXPECT_STREQ("C,D,G,X", GetMonsterCookies(monster).c_str());
651 EXPECT_STREQ("foo0,_Cookies,__C,__D," 651 EXPECT_STREQ("foo0,_Cookies,__C,__D,"
652 "foo2,_Cookies,__G,__X," 652 "foo2,_Cookies,__G,__X,"
653 "gdbhost1,_Web Databases,__db1," 653 "gdbhost1,_Web Databases,__db1,"
654 "gdbhost2,_Web Databases,__db2," 654 "gdbhost2,_Web Databases,__db2,"
655 "host1,_Local Storage,__origin1," 655 "host1,_Local Storage,__http://host1:1/,"
656 "host2,_Local Storage,__origin2", 656 "host2,_Local Storage,__http://host2:2/",
657 GetDisplayedCookies(cookies_view).c_str()); 657 GetDisplayedCookies(cookies_view).c_str());
658 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 658 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
659 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 659 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
660 EXPECT_STREQ("1", GetSelectedPath(cookies_view).c_str()); 660 EXPECT_STREQ("1", GetSelectedPath(cookies_view).c_str());
661 661
662 ASSERT_TRUE(SelectByPath(cookies_view, "0")); 662 ASSERT_TRUE(SelectByPath(cookies_view, "0"));
663 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 663 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
664 664
665 EXPECT_STREQ("G,X", GetMonsterCookies(monster).c_str()); 665 EXPECT_STREQ("G,X", GetMonsterCookies(monster).c_str());
666 EXPECT_STREQ("foo2,_Cookies,__G,__X," 666 EXPECT_STREQ("foo2,_Cookies,__G,__X,"
667 "gdbhost1,_Web Databases,__db1," 667 "gdbhost1,_Web Databases,__db1,"
668 "gdbhost2,_Web Databases,__db2," 668 "gdbhost2,_Web Databases,__db2,"
669 "host1,_Local Storage,__origin1," 669 "host1,_Local Storage,__http://host1:1/,"
670 "host2,_Local Storage,__origin2", 670 "host2,_Local Storage,__http://host2:2/",
671 GetDisplayedCookies(cookies_view).c_str()); 671 GetDisplayedCookies(cookies_view).c_str());
672 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 672 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
673 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 673 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
674 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str()); 674 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str());
675 675
676 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 676 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
677 677
678 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 678 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
679 EXPECT_STREQ("gdbhost1,_Web Databases,__db1," 679 EXPECT_STREQ("gdbhost1,_Web Databases,__db1,"
680 "gdbhost2,_Web Databases,__db2," 680 "gdbhost2,_Web Databases,__db2,"
681 "host1,_Local Storage,__origin1," 681 "host1,_Local Storage,__http://host1:1/,"
682 "host2,_Local Storage,__origin2", 682 "host2,_Local Storage,__http://host2:2/",
683 GetDisplayedCookies(cookies_view).c_str()); 683 GetDisplayedCookies(cookies_view).c_str());
684 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 684 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
685 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 685 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
686 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str()); 686 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str());
687 687
688 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 688 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
689 689
690 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 690 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
691 EXPECT_STREQ("gdbhost2,_Web Databases,__db2," 691 EXPECT_STREQ("gdbhost2,_Web Databases,__db2,"
692 "host1,_Local Storage,__origin1," 692 "host1,_Local Storage,__http://host1:1/,"
693 "host2,_Local Storage,__origin2", 693 "host2,_Local Storage,__http://host2:2/",
694 GetDisplayedCookies(cookies_view).c_str()); 694 GetDisplayedCookies(cookies_view).c_str());
695 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 695 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
696 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 696 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
697 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_origin_ == 697 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_origin_ ==
698 "http_gdbhost1_1"); 698 "http_gdbhost1_1");
699 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_db_ == 699 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_db_ ==
700 "db1"); 700 "db1");
701 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str()); 701 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str());
702 702
703 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 703 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
704 704
705 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 705 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
706 EXPECT_STREQ("host1,_Local Storage,__origin1," 706 EXPECT_STREQ("host1,_Local Storage,__http://host1:1/,"
707 "host2,_Local Storage,__origin2", 707 "host2,_Local Storage,__http://host2:2/",
708 GetDisplayedCookies(cookies_view).c_str()); 708 GetDisplayedCookies(cookies_view).c_str());
709 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 709 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
710 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 710 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
711 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_origin_ == 711 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_origin_ ==
712 "http_gdbhost2_2"); 712 "http_gdbhost2_2");
713 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_db_ == 713 EXPECT_TRUE(mock_browsing_data_database_helper_->last_deleted_db_ ==
714 "db2"); 714 "db2");
715 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str()); 715 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str());
716 716
717 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 717 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
718 718
719 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 719 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
720 EXPECT_STREQ("host2,_Local Storage,__origin2", 720 EXPECT_STREQ("host2,_Local Storage,__http://host2:2/",
721 GetDisplayedCookies(cookies_view).c_str()); 721 GetDisplayedCookies(cookies_view).c_str());
722 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 722 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
723 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 723 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
724 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->last_deleted_file_ == 724 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->last_deleted_file_ ==
725 FilePath(FILE_PATH_LITERAL("file1"))); 725 FilePath(FILE_PATH_LITERAL("file1")));
726 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str()); 726 EXPECT_STREQ("0", GetSelectedPath(cookies_view).c_str());
727 727
728 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 728 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
729 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 729 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
730 EXPECT_STREQ("", 730 EXPECT_STREQ("",
(...skipping 24 matching lines...) Expand all
755 mock_browsing_data_database_helper_->AddDatabaseSamples(); 755 mock_browsing_data_database_helper_->AddDatabaseSamples();
756 mock_browsing_data_database_helper_->Notify(); 756 mock_browsing_data_database_helper_->Notify();
757 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); 757 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
758 mock_browsing_data_local_storage_helper_->Notify(); 758 mock_browsing_data_local_storage_helper_->Notify();
759 759
760 EXPECT_STREQ("foo0,_Cookies,__C,__D," 760 EXPECT_STREQ("foo0,_Cookies,__C,__D,"
761 "foo1,_Cookies,__A,__B,__E," 761 "foo1,_Cookies,__A,__B,__E,"
762 "foo2,_Cookies,__G,__X," 762 "foo2,_Cookies,__G,__X,"
763 "gdbhost1,_Web Databases,__db1," 763 "gdbhost1,_Web Databases,__db1,"
764 "gdbhost2,_Web Databases,__db2," 764 "gdbhost2,_Web Databases,__db2,"
765 "host1,_Local Storage,__origin1," 765 "host1,_Local Storage,__http://host1:1/,"
766 "host2,_Local Storage,__origin2", 766 "host2,_Local Storage,__http://host2:2/",
767 GetDisplayedCookies(cookies_view).c_str()); 767 GetDisplayedCookies(cookies_view).c_str());
768 768
769 769
770 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 770 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
771 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 771 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
772 772
773 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 773 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
774 774
775 EXPECT_STREQ("B,A,E,G,X", GetMonsterCookies(monster).c_str()); 775 EXPECT_STREQ("B,A,E,G,X", GetMonsterCookies(monster).c_str());
776 EXPECT_STREQ("foo1,_Cookies,__A,__B,__E," 776 EXPECT_STREQ("foo1,_Cookies,__A,__B,__E,"
777 "foo2,_Cookies,__G,__X," 777 "foo2,_Cookies,__G,__X,"
778 "gdbhost1,_Web Databases,__db1," 778 "gdbhost1,_Web Databases,__db1,"
779 "gdbhost2,_Web Databases,__db2," 779 "gdbhost2,_Web Databases,__db2,"
780 "host1,_Local Storage,__origin1," 780 "host1,_Local Storage,__http://host1:1/,"
781 "host2,_Local Storage,__origin2", 781 "host2,_Local Storage,__http://host2:2/",
782 GetDisplayedCookies(cookies_view).c_str()); 782 GetDisplayedCookies(cookies_view).c_str());
783 783
784 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 784 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
785 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 785 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
786 786
787 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 787 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
788 788
789 EXPECT_STREQ("G,X", GetMonsterCookies(monster).c_str()); 789 EXPECT_STREQ("G,X", GetMonsterCookies(monster).c_str());
790 EXPECT_STREQ("foo2,_Cookies,__G,__X," 790 EXPECT_STREQ("foo2,_Cookies,__G,__X,"
791 "gdbhost1,_Web Databases,__db1," 791 "gdbhost1,_Web Databases,__db1,"
792 "gdbhost2,_Web Databases,__db2," 792 "gdbhost2,_Web Databases,__db2,"
793 "host1,_Local Storage,__origin1," 793 "host1,_Local Storage,__http://host1:1/,"
794 "host2,_Local Storage,__origin2", 794 "host2,_Local Storage,__http://host2:2/",
795 GetDisplayedCookies(cookies_view).c_str()); 795 GetDisplayedCookies(cookies_view).c_str());
796 796
797 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 797 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
798 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 798 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
799 799
800 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 800 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
801 801
802 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 802 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
803 EXPECT_STREQ("gdbhost1,_Web Databases,__db1," 803 EXPECT_STREQ("gdbhost1,_Web Databases,__db1,"
804 "gdbhost2,_Web Databases,__db2," 804 "gdbhost2,_Web Databases,__db2,"
805 "host1,_Local Storage,__origin1," 805 "host1,_Local Storage,__http://host1:1/,"
806 "host2,_Local Storage,__origin2", 806 "host2,_Local Storage,__http://host2:2/",
807 GetDisplayedCookies(cookies_view).c_str()); 807 GetDisplayedCookies(cookies_view).c_str());
808 808
809 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 809 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
810 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 810 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
811 811
812 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 812 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
813 813
814 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 814 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
815 EXPECT_STREQ("gdbhost2,_Web Databases,__db2," 815 EXPECT_STREQ("gdbhost2,_Web Databases,__db2,"
816 "host1,_Local Storage,__origin1," 816 "host1,_Local Storage,__http://host1:1/,"
817 "host2,_Local Storage,__origin2", 817 "host2,_Local Storage,__http://host2:2/",
818 GetDisplayedCookies(cookies_view).c_str()); 818 GetDisplayedCookies(cookies_view).c_str());
819 819
820 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 820 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
821 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 821 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
822 822
823 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 823 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
824 824
825 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 825 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
826 EXPECT_STREQ("host1,_Local Storage,__origin1," 826 EXPECT_STREQ("host1,_Local Storage,__http://host1:1/,"
827 "host2,_Local Storage,__origin2", 827 "host2,_Local Storage,__http://host2:2/",
828 GetDisplayedCookies(cookies_view).c_str()); 828 GetDisplayedCookies(cookies_view).c_str());
829 829
830 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 830 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
831 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 831 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
832 832
833 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 833 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
834 834
835 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 835 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
836 EXPECT_STREQ("host2,_Local Storage,__origin2", 836 EXPECT_STREQ("host2,_Local Storage,__http://host2:2/",
837 GetDisplayedCookies(cookies_view).c_str()); 837 GetDisplayedCookies(cookies_view).c_str());
838 838
839 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 839 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
840 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 840 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
841 841
842 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 842 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
843 843
844 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); 844 EXPECT_STREQ("", GetMonsterCookies(monster).c_str());
845 EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str()); 845 EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str());
846 846
(...skipping 17 matching lines...) Expand all
864 mock_browsing_data_database_helper_->Notify(); 864 mock_browsing_data_database_helper_->Notify();
865 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); 865 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
866 mock_browsing_data_local_storage_helper_->Notify(); 866 mock_browsing_data_local_storage_helper_->Notify();
867 867
868 EXPECT_STREQ("bar0,_Cookies,__D," 868 EXPECT_STREQ("bar0,_Cookies,__D,"
869 "bar1,_Cookies,__A," 869 "bar1,_Cookies,__A,"
870 "foo0,_Cookies,__C," 870 "foo0,_Cookies,__C,"
871 "foo1,_Cookies,__B," 871 "foo1,_Cookies,__B,"
872 "gdbhost1,_Web Databases,__db1," 872 "gdbhost1,_Web Databases,__db1,"
873 "gdbhost2,_Web Databases,__db2," 873 "gdbhost2,_Web Databases,__db2,"
874 "host1,_Local Storage,__origin1," 874 "host1,_Local Storage,__http://host1:1/,"
875 "host2,_Local Storage,__origin2", 875 "host2,_Local Storage,__http://host2:2/",
876 GetDisplayedCookies(cookies_view).c_str()); 876 GetDisplayedCookies(cookies_view).c_str());
877 877
878 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_)); 878 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_));
879 879
880 gtk_entry_set_text(GTK_ENTRY(cookies_view.filter_entry_), "bar"); 880 gtk_entry_set_text(GTK_ENTRY(cookies_view.filter_entry_), "bar");
881 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_)); 881 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_));
882 // Entering text doesn't immediately filter the results. 882 // Entering text doesn't immediately filter the results.
883 EXPECT_STREQ("bar0,_Cookies,__D," 883 EXPECT_STREQ("bar0,_Cookies,__D,"
884 "bar1,_Cookies,__A," 884 "bar1,_Cookies,__A,"
885 "foo0,_Cookies,__C," 885 "foo0,_Cookies,__C,"
886 "foo1,_Cookies,__B," 886 "foo1,_Cookies,__B,"
887 "gdbhost1,_Web Databases,__db1," 887 "gdbhost1,_Web Databases,__db1,"
888 "gdbhost2,_Web Databases,__db2," 888 "gdbhost2,_Web Databases,__db2,"
889 "host1,_Local Storage,__origin1," 889 "host1,_Local Storage,__http://host1:1/,"
890 "host2,_Local Storage,__origin2", 890 "host2,_Local Storage,__http://host2:2/",
891 GetDisplayedCookies(cookies_view).c_str()); 891 GetDisplayedCookies(cookies_view).c_str());
892 892
893 // Results are filtered immediately if you activate (hit enter in the entry). 893 // Results are filtered immediately if you activate (hit enter in the entry).
894 gtk_widget_activate(cookies_view.filter_entry_); 894 gtk_widget_activate(cookies_view.filter_entry_);
895 EXPECT_STREQ("bar0,_Cookies,__D," 895 EXPECT_STREQ("bar0,_Cookies,__D,"
896 "bar1,_Cookies,__A", 896 "bar1,_Cookies,__A",
897 GetDisplayedCookies(cookies_view).c_str()); 897 GetDisplayedCookies(cookies_view).c_str());
898 898
899 gtk_button_clicked(GTK_BUTTON(cookies_view.filter_clear_button_)); 899 gtk_button_clicked(GTK_BUTTON(cookies_view.filter_clear_button_));
900 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_)); 900 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_));
901 EXPECT_STREQ("", gtk_entry_get_text(GTK_ENTRY(cookies_view.filter_entry_))); 901 EXPECT_STREQ("", gtk_entry_get_text(GTK_ENTRY(cookies_view.filter_entry_)));
902 EXPECT_STREQ("bar0,_Cookies,__D," 902 EXPECT_STREQ("bar0,_Cookies,__D,"
903 "bar1,_Cookies,__A," 903 "bar1,_Cookies,__A,"
904 "foo0,_Cookies,__C," 904 "foo0,_Cookies,__C,"
905 "foo1,_Cookies,__B," 905 "foo1,_Cookies,__B,"
906 "gdbhost1,_Web Databases,__db1," 906 "gdbhost1,_Web Databases,__db1,"
907 "gdbhost2,_Web Databases,__db2," 907 "gdbhost2,_Web Databases,__db2,"
908 "host1,_Local Storage,__origin1," 908 "host1,_Local Storage,__http://host1:1/,"
909 "host2,_Local Storage,__origin2", 909 "host2,_Local Storage,__http://host2:2/",
910 GetDisplayedCookies(cookies_view).c_str()); 910 GetDisplayedCookies(cookies_view).c_str());
911 911
912 gtk_entry_set_text(GTK_ENTRY(cookies_view.filter_entry_), "hos"); 912 gtk_entry_set_text(GTK_ENTRY(cookies_view.filter_entry_), "hos");
913 gtk_widget_activate(cookies_view.filter_entry_); 913 gtk_widget_activate(cookies_view.filter_entry_);
914 EXPECT_STREQ("gdbhost1,_Web Databases,__db1," 914 EXPECT_STREQ("gdbhost1,_Web Databases,__db1,"
915 "gdbhost2,_Web Databases,__db2," 915 "gdbhost2,_Web Databases,__db2,"
916 "host1,_Local Storage,__origin1," 916 "host1,_Local Storage,__http://host1:1/,"
917 "host2,_Local Storage,__origin2", 917 "host2,_Local Storage,__http://host2:2/",
918 GetDisplayedCookies(cookies_view).c_str()); 918 GetDisplayedCookies(cookies_view).c_str());
919 } 919 }
920 920
921 TEST_F(CookiesViewTest, FilterRemoveAll) { 921 TEST_F(CookiesViewTest, FilterRemoveAll) {
922 net::CookieMonster* monster = profile_->GetCookieMonster(); 922 net::CookieMonster* monster = profile_->GetCookieMonster();
923 monster->SetCookie(GURL("http://foo0"), "C=1"); 923 monster->SetCookie(GURL("http://foo0"), "C=1");
924 monster->SetCookie(GURL("http://bar0"), "D=1"); 924 monster->SetCookie(GURL("http://bar0"), "D=1");
925 monster->SetCookie(GURL("http://foo1"), "B=1"); 925 monster->SetCookie(GURL("http://foo1"), "B=1");
926 monster->SetCookie(GURL("http://bar1"), "A=1"); 926 monster->SetCookie(GURL("http://bar1"), "A=1");
927 CookiesView cookies_view(NULL, 927 CookiesView cookies_view(NULL,
928 profile_.get(), 928 profile_.get(),
929 mock_browsing_data_database_helper_, 929 mock_browsing_data_database_helper_,
930 mock_browsing_data_local_storage_helper_, 930 mock_browsing_data_local_storage_helper_,
931 mock_browsing_data_appcache_helper_); 931 mock_browsing_data_appcache_helper_);
932 cookies_view.TestDestroySyncrhonously(); 932 cookies_view.TestDestroySyncrhonously();
933 mock_browsing_data_database_helper_->AddDatabaseSamples(); 933 mock_browsing_data_database_helper_->AddDatabaseSamples();
934 mock_browsing_data_database_helper_->Notify(); 934 mock_browsing_data_database_helper_->Notify();
935 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); 935 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
936 mock_browsing_data_local_storage_helper_->Notify(); 936 mock_browsing_data_local_storage_helper_->Notify();
937 937
938 EXPECT_STREQ("bar0,_Cookies,__D," 938 EXPECT_STREQ("bar0,_Cookies,__D,"
939 "bar1,_Cookies,__A," 939 "bar1,_Cookies,__A,"
940 "foo0,_Cookies,__C," 940 "foo0,_Cookies,__C,"
941 "foo1,_Cookies,__B," 941 "foo1,_Cookies,__B,"
942 "gdbhost1,_Web Databases,__db1," 942 "gdbhost1,_Web Databases,__db1,"
943 "gdbhost2,_Web Databases,__db2," 943 "gdbhost2,_Web Databases,__db2,"
944 "host1,_Local Storage,__origin1," 944 "host1,_Local Storage,__http://host1:1/,"
945 "host2,_Local Storage,__origin2", 945 "host2,_Local Storage,__http://host2:2/",
946 GetDisplayedCookies(cookies_view).c_str()); 946 GetDisplayedCookies(cookies_view).c_str());
947 947
948 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_)); 948 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_));
949 949
950 gtk_entry_set_text(GTK_ENTRY(cookies_view.filter_entry_), "bar"); 950 gtk_entry_set_text(GTK_ENTRY(cookies_view.filter_entry_), "bar");
951 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_)); 951 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_));
952 // Entering text doesn't immediately filter the results. 952 // Entering text doesn't immediately filter the results.
953 EXPECT_STREQ("bar0,_Cookies,__D," 953 EXPECT_STREQ("bar0,_Cookies,__D,"
954 "bar1,_Cookies,__A," 954 "bar1,_Cookies,__A,"
955 "foo0,_Cookies,__C," 955 "foo0,_Cookies,__C,"
956 "foo1,_Cookies,__B," 956 "foo1,_Cookies,__B,"
957 "gdbhost1,_Web Databases,__db1," 957 "gdbhost1,_Web Databases,__db1,"
958 "gdbhost2,_Web Databases,__db2," 958 "gdbhost2,_Web Databases,__db2,"
959 "host1,_Local Storage,__origin1," 959 "host1,_Local Storage,__http://host1:1/,"
960 "host2,_Local Storage,__origin2", 960 "host2,_Local Storage,__http://host2:2/",
961 GetDisplayedCookies(cookies_view).c_str()); 961 GetDisplayedCookies(cookies_view).c_str());
962 962
963 // Results are filtered immediately if you activate (hit enter in the entry). 963 // Results are filtered immediately if you activate (hit enter in the entry).
964 gtk_widget_activate(cookies_view.filter_entry_); 964 gtk_widget_activate(cookies_view.filter_entry_);
965 EXPECT_STREQ("bar0,_Cookies,__D," 965 EXPECT_STREQ("bar0,_Cookies,__D,"
966 "bar1,_Cookies,__A", 966 "bar1,_Cookies,__A",
967 GetDisplayedCookies(cookies_view).c_str()); 967 GetDisplayedCookies(cookies_view).c_str());
968 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 968 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
969 969
970 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_all_button_)); 970 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_all_button_));
971 971
972 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 972 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
973 EXPECT_STREQ("", 973 EXPECT_STREQ("",
974 GetDisplayedCookies(cookies_view).c_str()); 974 GetDisplayedCookies(cookies_view).c_str());
975 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_)); 975 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_));
976 976
977 gtk_button_clicked(GTK_BUTTON(cookies_view.filter_clear_button_)); 977 gtk_button_clicked(GTK_BUTTON(cookies_view.filter_clear_button_));
978 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_)); 978 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_));
979 EXPECT_STREQ("", gtk_entry_get_text(GTK_ENTRY(cookies_view.filter_entry_))); 979 EXPECT_STREQ("", gtk_entry_get_text(GTK_ENTRY(cookies_view.filter_entry_)));
980 EXPECT_STREQ("foo0,_Cookies,__C," 980 EXPECT_STREQ("foo0,_Cookies,__C,"
981 "foo1,_Cookies,__B," 981 "foo1,_Cookies,__B,"
982 "gdbhost1,_Web Databases,__db1," 982 "gdbhost1,_Web Databases,__db1,"
983 "gdbhost2,_Web Databases,__db2," 983 "gdbhost2,_Web Databases,__db2,"
984 "host1,_Local Storage,__origin1," 984 "host1,_Local Storage,__http://host1:1/,"
985 "host2,_Local Storage,__origin2", 985 "host2,_Local Storage,__http://host2:2/",
986 GetDisplayedCookies(cookies_view).c_str()); 986 GetDisplayedCookies(cookies_view).c_str());
987 } 987 }
988 988
989 TEST_F(CookiesViewTest, FilterRemove) { 989 TEST_F(CookiesViewTest, FilterRemove) {
990 net::CookieMonster* monster = profile_->GetCookieMonster(); 990 net::CookieMonster* monster = profile_->GetCookieMonster();
991 monster->SetCookie(GURL("http://foo0"), "C=1"); 991 monster->SetCookie(GURL("http://foo0"), "C=1");
992 monster->SetCookie(GURL("http://bar0"), "D=1"); 992 monster->SetCookie(GURL("http://bar0"), "D=1");
993 monster->SetCookie(GURL("http://foo1"), "B=1"); 993 monster->SetCookie(GURL("http://foo1"), "B=1");
994 monster->SetCookie(GURL("http://bar1"), "A=1"); 994 monster->SetCookie(GURL("http://bar1"), "A=1");
995 monster->SetCookie(GURL("http://bar1"), "E=1"); 995 monster->SetCookie(GURL("http://bar1"), "E=1");
996 CookiesView cookies_view(NULL, 996 CookiesView cookies_view(NULL,
997 profile_.get(), 997 profile_.get(),
998 mock_browsing_data_database_helper_, 998 mock_browsing_data_database_helper_,
999 mock_browsing_data_local_storage_helper_, 999 mock_browsing_data_local_storage_helper_,
1000 mock_browsing_data_appcache_helper_); 1000 mock_browsing_data_appcache_helper_);
1001 cookies_view.TestDestroySyncrhonously(); 1001 cookies_view.TestDestroySyncrhonously();
1002 mock_browsing_data_database_helper_->AddDatabaseSamples(); 1002 mock_browsing_data_database_helper_->AddDatabaseSamples();
1003 mock_browsing_data_database_helper_->Notify(); 1003 mock_browsing_data_database_helper_->Notify();
1004 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); 1004 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
1005 mock_browsing_data_local_storage_helper_->Notify(); 1005 mock_browsing_data_local_storage_helper_->Notify();
1006 1006
1007 EXPECT_STREQ("bar0,_Cookies,__D," 1007 EXPECT_STREQ("bar0,_Cookies,__D,"
1008 "bar1,_Cookies,__A,__E," 1008 "bar1,_Cookies,__A,__E,"
1009 "foo0,_Cookies,__C," 1009 "foo0,_Cookies,__C,"
1010 "foo1,_Cookies,__B," 1010 "foo1,_Cookies,__B,"
1011 "gdbhost1,_Web Databases,__db1," 1011 "gdbhost1,_Web Databases,__db1,"
1012 "gdbhost2,_Web Databases,__db2," 1012 "gdbhost2,_Web Databases,__db2,"
1013 "host1,_Local Storage,__origin1," 1013 "host1,_Local Storage,__http://host1:1/,"
1014 "host2,_Local Storage,__origin2", 1014 "host2,_Local Storage,__http://host2:2/",
1015 GetDisplayedCookies(cookies_view).c_str()); 1015 GetDisplayedCookies(cookies_view).c_str());
1016 EXPECT_STREQ("D,A,E,C,B", GetMonsterCookies(monster).c_str()); 1016 EXPECT_STREQ("D,A,E,C,B", GetMonsterCookies(monster).c_str());
1017 1017
1018 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_)); 1018 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_));
1019 1019
1020 gtk_entry_set_text(GTK_ENTRY(cookies_view.filter_entry_), "bar"); 1020 gtk_entry_set_text(GTK_ENTRY(cookies_view.filter_entry_), "bar");
1021 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_)); 1021 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_));
1022 // Entering text doesn't immediately filter the results. 1022 // Entering text doesn't immediately filter the results.
1023 EXPECT_STREQ("bar0,_Cookies,__D," 1023 EXPECT_STREQ("bar0,_Cookies,__D,"
1024 "bar1,_Cookies,__A,__E," 1024 "bar1,_Cookies,__A,__E,"
1025 "foo0,_Cookies,__C," 1025 "foo0,_Cookies,__C,"
1026 "foo1,_Cookies,__B," 1026 "foo1,_Cookies,__B,"
1027 "gdbhost1,_Web Databases,__db1," 1027 "gdbhost1,_Web Databases,__db1,"
1028 "gdbhost2,_Web Databases,__db2," 1028 "gdbhost2,_Web Databases,__db2,"
1029 "host1,_Local Storage,__origin1," 1029 "host1,_Local Storage,__http://host1:1/,"
1030 "host2,_Local Storage,__origin2", 1030 "host2,_Local Storage,__http://host2:2/",
1031 GetDisplayedCookies(cookies_view).c_str()); 1031 GetDisplayedCookies(cookies_view).c_str());
1032 1032
1033 // Results are filtered immediately if you activate (hit enter in the entry). 1033 // Results are filtered immediately if you activate (hit enter in the entry).
1034 gtk_widget_activate(cookies_view.filter_entry_); 1034 gtk_widget_activate(cookies_view.filter_entry_);
1035 EXPECT_STREQ("bar0,_Cookies,__D," 1035 EXPECT_STREQ("bar0,_Cookies,__D,"
1036 "bar1,_Cookies,__A,__E", 1036 "bar1,_Cookies,__A,__E",
1037 GetDisplayedCookies(cookies_view).c_str()); 1037 GetDisplayedCookies(cookies_view).c_str());
1038 1038
1039 ASSERT_TRUE(ExpandByPath(cookies_view, "1")); 1039 ASSERT_TRUE(ExpandByPath(cookies_view, "1"));
1040 EXPECT_STREQ("bar0,_Cookies,__D," 1040 EXPECT_STREQ("bar0,_Cookies,__D,"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str()); 1089 EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str());
1090 } 1090 }
1091 1091
1092 gtk_button_clicked(GTK_BUTTON(cookies_view.filter_clear_button_)); 1092 gtk_button_clicked(GTK_BUTTON(cookies_view.filter_clear_button_));
1093 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_)); 1093 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_));
1094 EXPECT_STREQ("", gtk_entry_get_text(GTK_ENTRY(cookies_view.filter_entry_))); 1094 EXPECT_STREQ("", gtk_entry_get_text(GTK_ENTRY(cookies_view.filter_entry_)));
1095 EXPECT_STREQ("foo0,_Cookies,__C," 1095 EXPECT_STREQ("foo0,_Cookies,__C,"
1096 "foo1,_Cookies,__B," 1096 "foo1,_Cookies,__B,"
1097 "gdbhost1,_Web Databases,__db1," 1097 "gdbhost1,_Web Databases,__db1,"
1098 "gdbhost2,_Web Databases,__db2," 1098 "gdbhost2,_Web Databases,__db2,"
1099 "host1,_Local Storage,__origin1," 1099 "host1,_Local Storage,__http://host1:1/,"
1100 "host2,_Local Storage,__origin2", 1100 "host2,_Local Storage,__http://host2:2/",
1101 GetDisplayedCookies(cookies_view).c_str()); 1101 GetDisplayedCookies(cookies_view).c_str());
1102 1102
1103 gtk_entry_set_text(GTK_ENTRY(cookies_view.filter_entry_), "hos"); 1103 gtk_entry_set_text(GTK_ENTRY(cookies_view.filter_entry_), "hos");
1104 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_)); 1104 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.filter_clear_button_));
1105 // Entering text doesn't immediately filter the results. 1105 // Entering text doesn't immediately filter the results.
1106 EXPECT_STREQ("foo0,_Cookies,__C," 1106 EXPECT_STREQ("foo0,_Cookies,__C,"
1107 "foo1,_Cookies,__B," 1107 "foo1,_Cookies,__B,"
1108 "gdbhost1,_Web Databases,__db1," 1108 "gdbhost1,_Web Databases,__db1,"
1109 "gdbhost2,_Web Databases,__db2," 1109 "gdbhost2,_Web Databases,__db2,"
1110 "host1,_Local Storage,__origin1," 1110 "host1,_Local Storage,__http://host1:1/,"
1111 "host2,_Local Storage,__origin2", 1111 "host2,_Local Storage,__http://host2:2/",
1112 GetDisplayedCookies(cookies_view).c_str()); 1112 GetDisplayedCookies(cookies_view).c_str());
1113 1113
1114 // Results are filtered immediately if you activate (hit enter in the entry). 1114 // Results are filtered immediately if you activate (hit enter in the entry).
1115 gtk_widget_activate(cookies_view.filter_entry_); 1115 gtk_widget_activate(cookies_view.filter_entry_);
1116 EXPECT_STREQ("gdbhost1,_Web Databases,__db1," 1116 EXPECT_STREQ("gdbhost1,_Web Databases,__db1,"
1117 "gdbhost2,_Web Databases,__db2," 1117 "gdbhost2,_Web Databases,__db2,"
1118 "host1,_Local Storage,__origin1," 1118 "host1,_Local Storage,__http://host1:1/,"
1119 "host2,_Local Storage,__origin2", 1119 "host2,_Local Storage,__http://host2:2/",
1120 GetDisplayedCookies(cookies_view).c_str()); 1120 GetDisplayedCookies(cookies_view).c_str());
1121 1121
1122 ASSERT_TRUE(ExpandByPath(cookies_view, "1")); 1122 ASSERT_TRUE(ExpandByPath(cookies_view, "1"));
1123 EXPECT_STREQ("gdbhost1,_Web Databases,__db1," 1123 EXPECT_STREQ("gdbhost1,_Web Databases,__db1,"
1124 "gdbhost2,+Web Databases,++db2," 1124 "gdbhost2,+Web Databases,++db2,"
1125 "host1,_Local Storage,__origin1," 1125 "host1,_Local Storage,__http://host1:1/,"
1126 "host2,_Local Storage,__origin2", 1126 "host2,_Local Storage,__http://host2:2/",
1127 GetDisplayedCookies(cookies_view).c_str()); 1127 GetDisplayedCookies(cookies_view).c_str());
1128 ASSERT_TRUE(SelectByPath(cookies_view, "1:0:0")); 1128 ASSERT_TRUE(SelectByPath(cookies_view, "1:0:0"));
1129 1129
1130 { 1130 {
1131 SCOPED_TRACE("First selection"); 1131 SCOPED_TRACE("First selection");
1132 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 1132 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
1133 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 1133 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
1134 CheckDetailsSensitivity(FALSE, TRUE, FALSE, FALSE, cookies_view); 1134 CheckDetailsSensitivity(FALSE, TRUE, FALSE, FALSE, cookies_view);
1135 } 1135 }
1136 1136
1137 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 1137 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
1138 1138
1139 { 1139 {
1140 SCOPED_TRACE("First selection removed"); 1140 SCOPED_TRACE("First selection removed");
1141 EXPECT_STREQ("C,B", GetMonsterCookies(monster).c_str()); 1141 EXPECT_STREQ("C,B", GetMonsterCookies(monster).c_str());
1142 EXPECT_STREQ("gdbhost1,_Web Databases,__db1," 1142 EXPECT_STREQ("gdbhost1,_Web Databases,__db1,"
1143 "host1,_Local Storage,__origin1," 1143 "host1,_Local Storage,__http://host1:1/,"
1144 "host2,_Local Storage,__origin2", 1144 "host2,_Local Storage,__http://host2:2/",
1145 GetDisplayedCookies(cookies_view).c_str()); 1145 GetDisplayedCookies(cookies_view).c_str());
1146 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 1146 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
1147 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 1147 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
1148 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view); 1148 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
1149 } 1149 }
1150 1150
1151 ASSERT_TRUE(ExpandByPath(cookies_view, "2")); 1151 ASSERT_TRUE(ExpandByPath(cookies_view, "2"));
1152 EXPECT_STREQ("gdbhost1,_Web Databases,__db1," 1152 EXPECT_STREQ("gdbhost1,_Web Databases,__db1,"
1153 "host1,_Local Storage,__origin1," 1153 "host1,_Local Storage,__http://host1:1/,"
1154 "host2,+Local Storage,++origin2", 1154 "host2,+Local Storage,++http://host2:2/",
1155 GetDisplayedCookies(cookies_view).c_str()); 1155 GetDisplayedCookies(cookies_view).c_str());
1156 ASSERT_TRUE(SelectByPath(cookies_view, "2:0:0")); 1156 ASSERT_TRUE(SelectByPath(cookies_view, "2:0:0"));
1157 1157
1158 { 1158 {
1159 SCOPED_TRACE("First selection"); 1159 SCOPED_TRACE("First selection");
1160 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 1160 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
1161 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 1161 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
1162 CheckDetailsSensitivity(FALSE, FALSE, TRUE, FALSE, cookies_view); 1162 CheckDetailsSensitivity(FALSE, FALSE, TRUE, FALSE, cookies_view);
1163 } 1163 }
1164 1164
1165 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); 1165 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
1166 1166
1167 { 1167 {
1168 SCOPED_TRACE("First selection removed"); 1168 SCOPED_TRACE("First selection removed");
1169 EXPECT_STREQ("C,B", GetMonsterCookies(monster).c_str()); 1169 EXPECT_STREQ("C,B", GetMonsterCookies(monster).c_str());
1170 EXPECT_STREQ("gdbhost1,_Web Databases,__db1," 1170 EXPECT_STREQ("gdbhost1,_Web Databases,__db1,"
1171 "host1,_Local Storage,__origin1", 1171 "host1,_Local Storage,__http://host1:1/",
1172 GetDisplayedCookies(cookies_view).c_str()); 1172 GetDisplayedCookies(cookies_view).c_str());
1173 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); 1173 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
1174 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); 1174 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
1175 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view); 1175 CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
1176 } 1176 }
1177 } 1177 }
OLDNEW
« no previous file with comments | « chrome/browser/cookies_tree_model_unittest.cc ('k') | chrome/browser/mock_browsing_data_database_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698