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

Unified Diff: chrome/browser/gtk/options/cookies_view_unittest.cc

Issue 650110: Teach the cookie tree view / model about appcaches. Not hooked up to real dat... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/options/cookies_view.cc ('k') | chrome/browser/mock_browsing_data_appcache_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/options/cookies_view_unittest.cc
===================================================================
--- chrome/browser/gtk/options/cookies_view_unittest.cc (revision 40156)
+++ chrome/browser/gtk/options/cookies_view_unittest.cc (working copy)
@@ -10,6 +10,7 @@
#include <gtk/gtk.h>
#include "base/string_util.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_local_storage_helper.h"
#include "chrome/browser/net/url_request_context_getter.h"
@@ -32,11 +33,14 @@
new MockBrowsingDataDatabaseHelper(profile_.get());
mock_browsing_data_local_storage_helper_ =
new MockBrowsingDataLocalStorageHelper(profile_.get());
+ mock_browsing_data_appcache_helper_ =
+ new MockBrowsingDataAppCacheHelper(profile_.get());
}
void CheckDetailsSensitivity(gboolean expected_cookies,
gboolean expected_database,
gboolean expected_local_storage,
+ gboolean expected_appcache,
const CookiesView& cookies_view) {
// Cookies
EXPECT_EQ(expected_cookies,
@@ -69,7 +73,16 @@
EXPECT_EQ(expected_local_storage,
GTK_WIDGET_SENSITIVE(
cookies_view.local_storage_last_modified_entry_));
-
+ // AppCache
+ EXPECT_EQ(expected_appcache,
+ GTK_WIDGET_SENSITIVE(cookies_view.appcache_manifest_entry_));
+ EXPECT_EQ(expected_appcache,
+ GTK_WIDGET_SENSITIVE(cookies_view.appcache_size_entry_));
+ EXPECT_EQ(expected_appcache,
+ GTK_WIDGET_SENSITIVE(cookies_view.appcache_created_entry_));
+ EXPECT_EQ(expected_appcache,
+ GTK_WIDGET_SENSITIVE(
+ cookies_view.appcache_last_accessed_entry_));
}
// Get the cookie names in the cookie list, as a comma seperated string.
@@ -178,16 +191,19 @@
mock_browsing_data_database_helper_;
scoped_refptr<MockBrowsingDataLocalStorageHelper>
mock_browsing_data_local_storage_helper_;
+ scoped_refptr<MockBrowsingDataAppCacheHelper>
+ mock_browsing_data_appcache_helper_;
};
TEST_F(CookiesViewTest, Empty) {
CookiesView cookies_view(NULL,
profile_.get(),
mock_browsing_data_database_helper_,
- mock_browsing_data_local_storage_helper_);
+ mock_browsing_data_local_storage_helper_,
+ mock_browsing_data_appcache_helper_);
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str());
}
@@ -203,7 +219,8 @@
CookiesView cookies_view(NULL,
profile_.get(),
mock_browsing_data_database_helper_,
- mock_browsing_data_local_storage_helper_);
+ mock_browsing_data_local_storage_helper_,
+ mock_browsing_data_appcache_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -218,7 +235,7 @@
GetDisplayedCookies(cookies_view).c_str());
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
}
TEST_F(CookiesViewTest, RemoveAll) {
@@ -228,7 +245,8 @@
CookiesView cookies_view(NULL,
profile_.get(),
mock_browsing_data_database_helper_,
- mock_browsing_data_local_storage_helper_);
+ mock_browsing_data_local_storage_helper_,
+ mock_browsing_data_appcache_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -241,7 +259,7 @@
SCOPED_TRACE("Before removing");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("foo,_Cookies,__A,foo2,_Cookies,__B,"
"gdbhost1,_Web Databases,__db1,"
"gdbhost2,_Web Databases,__db2,"
@@ -259,7 +277,7 @@
EXPECT_EQ(0u, monster->GetAllCookies().size());
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str());
EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted());
EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted());
@@ -273,7 +291,8 @@
CookiesView cookies_view(NULL,
profile_.get(),
mock_browsing_data_database_helper_,
- mock_browsing_data_local_storage_helper_);
+ mock_browsing_data_local_storage_helper_,
+ mock_browsing_data_appcache_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -285,7 +304,7 @@
SCOPED_TRACE("Before removing");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("foo,_Cookies,__A,foo2,_Cookies,__B,"
"gdbhost1,_Web Databases,__db1,"
"gdbhost2,_Web Databases,__db2,"
@@ -303,7 +322,7 @@
EXPECT_EQ(0u, monster->GetAllCookies().size());
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str());
EXPECT_EQ(0,
gtk_tree_selection_count_selected_rows(cookies_view.selection_));
@@ -320,7 +339,8 @@
CookiesView cookies_view(NULL,
profile_.get(),
mock_browsing_data_database_helper_,
- mock_browsing_data_local_storage_helper_);
+ mock_browsing_data_local_storage_helper_,
+ mock_browsing_data_appcache_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -333,7 +353,7 @@
SCOPED_TRACE("First selection");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(TRUE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("foo1,_Cookies,__A,foo2,+Cookies,++B,++C,"
"gdbhost1,_Web Databases,__db1,"
"gdbhost2,_Web Databases,__db2,"
@@ -356,7 +376,7 @@
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("1:0:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(TRUE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view);
}
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
@@ -374,7 +394,7 @@
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("1:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
}
ASSERT_TRUE(ExpandByPath(cookies_view, "0"));
@@ -394,7 +414,7 @@
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("0:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("foo1,+Cookies,foo2,+Cookies,"
"gdbhost1,_Web Databases,__db1,"
"gdbhost2,_Web Databases,__db2,"
@@ -420,7 +440,7 @@
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("2:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("foo1,+Cookies,foo2,+Cookies,"
"gdbhost1,+Web Databases,"
"gdbhost2,_Web Databases,__db2,"
@@ -450,7 +470,7 @@
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("4:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("foo1,+Cookies,foo2,+Cookies,"
"gdbhost1,+Web Databases,"
"gdbhost2,_Web Databases,__db2,"
@@ -474,7 +494,8 @@
CookiesView cookies_view(NULL,
profile_.get(),
mock_browsing_data_database_helper_,
- mock_browsing_data_local_storage_helper_);
+ mock_browsing_data_local_storage_helper_,
+ mock_browsing_data_appcache_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -637,7 +658,8 @@
CookiesView cookies_view(NULL,
profile_.get(),
mock_browsing_data_database_helper_,
- mock_browsing_data_local_storage_helper_);
+ mock_browsing_data_local_storage_helper_,
+ mock_browsing_data_appcache_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -761,7 +783,8 @@
CookiesView cookies_view(NULL,
profile_.get(),
mock_browsing_data_database_helper_,
- mock_browsing_data_local_storage_helper_);
+ mock_browsing_data_local_storage_helper_,
+ mock_browsing_data_appcache_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -867,7 +890,8 @@
CookiesView cookies_view(NULL,
profile_.get(),
mock_browsing_data_database_helper_,
- mock_browsing_data_local_storage_helper_);
+ mock_browsing_data_local_storage_helper_,
+ mock_browsing_data_appcache_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -935,7 +959,8 @@
CookiesView cookies_view(NULL,
profile_.get(),
mock_browsing_data_database_helper_,
- mock_browsing_data_local_storage_helper_);
+ mock_browsing_data_local_storage_helper_,
+ mock_browsing_data_appcache_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -1002,7 +1027,8 @@
CookiesView cookies_view(NULL,
profile_.get(),
mock_browsing_data_database_helper_,
- mock_browsing_data_local_storage_helper_);
+ mock_browsing_data_local_storage_helper_,
+ mock_browsing_data_appcache_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -1050,7 +1076,7 @@
SCOPED_TRACE("First selection");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(TRUE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view);
}
gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
@@ -1064,7 +1090,7 @@
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("1:0:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(TRUE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view);
}
gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
@@ -1078,7 +1104,7 @@
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("1:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
}
ASSERT_TRUE(ExpandByPath(cookies_view, "0"));
@@ -1092,7 +1118,7 @@
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("0:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("bar0,+Cookies,"
"bar1,+Cookies",
GetDisplayedCookies(cookies_view).c_str());
@@ -1140,7 +1166,7 @@
SCOPED_TRACE("First selection");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, TRUE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, TRUE, FALSE, FALSE, cookies_view);
}
gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
@@ -1156,7 +1182,7 @@
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("1:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
}
ASSERT_TRUE(ExpandByPath(cookies_view, "3"));
@@ -1171,7 +1197,7 @@
SCOPED_TRACE("First selection");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, TRUE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, TRUE, FALSE, cookies_view);
}
gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
@@ -1187,6 +1213,6 @@
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("3:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
}
}
« no previous file with comments | « chrome/browser/gtk/options/cookies_view.cc ('k') | chrome/browser/mock_browsing_data_appcache_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698