Display site permissions in a tab and add a tab to display information about...

Display site permissions in a tab and add a tab to display  information about the site's identity and the site's connection.

UI string changes: https://chromiumcodereview.appspot.com/10180002/

BUG=113688
TEST=WebsiteSettingsTest*

Review URL: https://chromiumcodereview.appspot.com/10163002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133886 0039d316-1c4b-4281-b951-d872f2087c98
parent 31b7610e
...@@ -32,6 +32,10 @@ using content::OpenURLParams; ...@@ -32,6 +32,10 @@ using content::OpenURLParams;
namespace { namespace {
// The background color of the tabs if a theme other than the native GTK theme
// is selected.
const GdkColor kBackgroundColor = GDK_COLOR_RGB(0xff, 0xff, 0xff);
std::string PermissionTypeToString(ContentSettingsType type) { std::string PermissionTypeToString(ContentSettingsType type) {
switch (type) { switch (type) {
case CONTENT_SETTINGS_TYPE_POPUPS: case CONTENT_SETTINGS_TYPE_POPUPS:
...@@ -74,9 +78,10 @@ WebsiteSettingsPopupGtk::WebsiteSettingsPopupGtk( ...@@ -74,9 +78,10 @@ WebsiteSettingsPopupGtk::WebsiteSettingsPopupGtk(
profile_(profile), profile_(profile),
tab_contents_wrapper_(tab_contents_wrapper), tab_contents_wrapper_(tab_contents_wrapper),
browser_(NULL), browser_(NULL),
site_info_contents_(NULL), header_box_(NULL),
cookies_section_contents_(NULL), cookies_section_contents_(NULL),
permissions_section_contents_(NULL), permissions_section_contents_(NULL),
identity_tab_contents_(NULL),
presenter_(NULL) { presenter_(NULL) {
BrowserWindowGtk* browser_window = BrowserWindowGtk* browser_window =
BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent);
...@@ -125,31 +130,59 @@ void WebsiteSettingsPopupGtk::InitContents() { ...@@ -125,31 +130,59 @@ void WebsiteSettingsPopupGtk::InitContents() {
gtk_util::RemoveAllChildren(contents_); gtk_util::RemoveAllChildren(contents_);
} }
site_info_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing); // Create popup header.
std::string title = header_box_ = gtk_vbox_new(FALSE, ui::kControlSpacing);
l10n_util::GetStringUTF8(IDS_PAGE_INFO_SITE_INFO_TITLE); gtk_box_pack_start(GTK_BOX(contents_), header_box_, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(contents_),
CreateSection(title, site_info_contents_), // Create the container for the contents of the permissions tab.
FALSE, FALSE, 0); GtkWidget* permission_tab_contents = gtk_vbox_new(FALSE, ui::kControlSpacing);
gtk_box_pack_start(GTK_BOX(contents_), gtk_container_set_border_width(GTK_CONTAINER(permission_tab_contents), 10);
gtk_hseparator_new(),
FALSE, FALSE, 0);
cookies_section_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing); cookies_section_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing);
title = l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA); std::string title = l10n_util::GetStringUTF8(
gtk_box_pack_start(GTK_BOX(contents_), IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA);
gtk_box_pack_start(GTK_BOX(permission_tab_contents),
CreateSection(title, CreateSection(title,
cookies_section_contents_), cookies_section_contents_),
FALSE, FALSE, 0); FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(contents_), gtk_box_pack_start(GTK_BOX(permission_tab_contents),
gtk_hseparator_new(), gtk_hseparator_new(),
FALSE, FALSE, 0); FALSE, FALSE, 0);
permissions_section_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing); permissions_section_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing);
title = l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS); title = l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS);
gtk_box_pack_start(GTK_BOX(contents_), gtk_box_pack_start(GTK_BOX(permission_tab_contents),
CreateSection(title, CreateSection(title,
permissions_section_contents_), permissions_section_contents_),
FALSE, FALSE, 0); FALSE, FALSE, 0);
// Create the container for the contents of the identity tab.
GtkWidget* info_tab = gtk_vbox_new(FALSE, ui::kControlSpacing);
identity_tab_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing);
gtk_container_set_border_width(GTK_CONTAINER(identity_tab_contents_), 10);
gtk_box_pack_start(GTK_BOX(info_tab),
identity_tab_contents_,
FALSE, FALSE, 0);
// Create tab container and add all tabs.
GtkWidget* notebook = gtk_notebook_new();
if (theme_service_->UsingNativeTheme())
gtk_widget_modify_bg(notebook, GTK_STATE_NORMAL, NULL);
else
gtk_widget_modify_bg(notebook, GTK_STATE_NORMAL, &kBackgroundColor);
GtkWidget* label = theme_service_->BuildLabel(
l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS),
ui::kGdkBlack);
gtk_widget_show(label);
gtk_notebook_append_page(
GTK_NOTEBOOK(notebook), permission_tab_contents, label);
label = theme_service_->BuildLabel(
l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_IDENTITY),
ui::kGdkBlack);
gtk_widget_show(label);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), info_tab, label);
gtk_box_pack_start(GTK_BOX(contents_), notebook, FALSE, FALSE, 0);
gtk_widget_show_all(contents_); gtk_widget_show_all(contents_);
} }
...@@ -161,18 +194,6 @@ void WebsiteSettingsPopupGtk::ClearContainer(GtkWidget* container) { ...@@ -161,18 +194,6 @@ void WebsiteSettingsPopupGtk::ClearContainer(GtkWidget* container) {
} }
} }
void WebsiteSettingsPopupGtk::SetSiteInfo(const std::string& site_info) {
DCHECK(site_info_contents_);
ClearContainer(site_info_contents_);
GtkWidget* label = theme_service_->BuildLabel(site_info,
ui::kGdkBlack);
GtkWidget* site_info_entry_box = gtk_hbox_new(FALSE, ui::kControlSpacing);
gtk_box_pack_start(GTK_BOX(site_info_entry_box), label, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(site_info_contents_), site_info_entry_box, FALSE,
FALSE, 0);
gtk_widget_show_all(site_info_contents_);
}
GtkWidget* WebsiteSettingsPopupGtk::CreateSection(std::string section_title, GtkWidget* WebsiteSettingsPopupGtk::CreateSection(std::string section_title,
GtkWidget* section_content) { GtkWidget* section_content) {
GtkWidget* section_box = gtk_vbox_new(FALSE, ui::kControlSpacing); GtkWidget* section_box = gtk_vbox_new(FALSE, ui::kControlSpacing);
...@@ -209,14 +230,7 @@ void WebsiteSettingsPopupGtk::SetCookieInfo( ...@@ -209,14 +230,7 @@ void WebsiteSettingsPopupGtk::SetCookieInfo(
it != cookie_info_list.end(); it != cookie_info_list.end();
++it) { ++it) {
GtkWidget* cookies_info = gtk_hbox_new(FALSE, 0); GtkWidget* cookies_info = gtk_hbox_new(FALSE, 0);
GtkWidget* label = CreateTextLabel(it->cookie_source, 200);
GtkWidget* label = theme_service_->BuildLabel(it->cookie_source,
ui::kGdkBlack);
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
gtk_util::SetLabelWidth(label, 200);
// Allow linebreaking in the middle of words if necessary, so that extremely
// long hostnames (longer than one line) will still be completely shown.
gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD_CHAR);
gtk_box_pack_start(GTK_BOX(cookies_info), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(cookies_info), label, FALSE, FALSE, 0);
std::string allowed_count = base::IntToString(it->allowed); std::string allowed_count = base::IntToString(it->allowed);
...@@ -251,6 +265,92 @@ void WebsiteSettingsPopupGtk::SetCookieInfo( ...@@ -251,6 +265,92 @@ void WebsiteSettingsPopupGtk::SetCookieInfo(
gtk_widget_show_all(cookies_section_contents_); gtk_widget_show_all(cookies_section_contents_);
} }
GtkWidget* WebsiteSettingsPopupGtk::CreateTextLabel(const std::string& text,
int width) {
GtkWidget* label = theme_service_->BuildLabel(text, ui::kGdkBlack);
gtk_util::SetLabelWidth(label, width);
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD_CHAR);
return label;
}
void WebsiteSettingsPopupGtk::SetIdentityInfo(
const IdentityInfo& identity_info) {
// Create popup header.
DCHECK(header_box_);
ClearContainer(header_box_);
GtkWidget* identity_label = theme_service_->BuildLabel(
identity_info.site_identity, ui::kGdkBlack);
gtk_label_set_selectable(GTK_LABEL(identity_label), TRUE);
PangoAttrList* attributes = pango_attr_list_new();
pango_attr_list_insert(attributes,
pango_attr_weight_new(PANGO_WEIGHT_BOLD));
gtk_label_set_attributes(GTK_LABEL(identity_label), attributes);
pango_attr_list_unref(attributes);
gtk_util::SetLabelWidth(identity_label, 400);
gtk_box_pack_start(GTK_BOX(header_box_), identity_label, FALSE, FALSE, 0);
std::string identity_status_text;
switch (identity_info.identity_status) {
case WebsiteSettings::SITE_IDENTITY_STATUS_CERT:
case WebsiteSettings::SITE_IDENTITY_STATUS_DNSSEC_CERT:
case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT:
identity_status_text =
l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_IDENTITY_VERIFIED);
break;
default:
identity_status_text =
l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_IDENTITY_NOT_VERIFIED);
break;
}
GtkWidget* status_label = CreateTextLabel(identity_status_text, 400);
gtk_box_pack_start(
GTK_BOX(header_box_), status_label, FALSE, FALSE, 0);
gtk_widget_show_all(header_box_);
// Create identity tab contents.
DCHECK(identity_tab_contents_);
ClearContainer(identity_tab_contents_);
// Create identity section.
GtkWidget* identity_description =
CreateTextLabel(identity_info.identity_status_description, 300);
GtkWidget* identity_box = gtk_vbox_new(FALSE, ui::kControlSpacing);
gtk_box_pack_start(GTK_BOX(identity_box), identity_description, FALSE, FALSE,
0);
// Create connection section.
GtkWidget* connection_description =
CreateTextLabel(identity_info.connection_status_description, 300);
GtkWidget* connection_box = gtk_vbox_new(FALSE, ui::kControlSpacing);
gtk_box_pack_start(GTK_BOX(connection_box), connection_description, FALSE,
FALSE, 0);
// Add to contents.
gtk_box_pack_start(
GTK_BOX(identity_tab_contents_), CreateSection(
l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TITEL_IDENTITY),
identity_box),
TRUE,
FALSE,
0);
gtk_box_pack_start(GTK_BOX(identity_tab_contents_),
gtk_hseparator_new(),
FALSE, FALSE, 0);
gtk_box_pack_start(
GTK_BOX(identity_tab_contents_),
CreateSection(
l10n_util::GetStringUTF8(
IDS_WEBSITE_SETTINGS_TITEL_CONNECTION),
connection_box),
TRUE,
FALSE,
0);
gtk_widget_show_all(identity_tab_contents_);
}
void WebsiteSettingsPopupGtk::SetPermissionInfo( void WebsiteSettingsPopupGtk::SetPermissionInfo(
const PermissionInfoList& permission_info_list) { const PermissionInfoList& permission_info_list) {
DCHECK(permissions_section_contents_); DCHECK(permissions_section_contents_);
...@@ -261,9 +361,8 @@ void WebsiteSettingsPopupGtk::SetPermissionInfo( ...@@ -261,9 +361,8 @@ void WebsiteSettingsPopupGtk::SetPermissionInfo(
permission != permission_info_list.end(); permission != permission_info_list.end();
++permission) { ++permission) {
// Add a label for the permission type. // Add a label for the permission type.
GtkWidget* label = theme_service_->BuildLabel( GtkWidget* label =
PermissionTypeToString(permission->type), ui::kGdkBlack); CreateTextLabel(PermissionTypeToString(permission->type), 250);
gtk_util::SetLabelWidth(label, 280);
GtkWidget* hbox = gtk_hbox_new(FALSE, 0); GtkWidget* hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
......
...@@ -31,10 +31,10 @@ class WebsiteSettingsPopupGtk : public WebsiteSettingsUI, ...@@ -31,10 +31,10 @@ class WebsiteSettingsPopupGtk : public WebsiteSettingsUI,
// WebsiteSettingsUI implementations. // WebsiteSettingsUI implementations.
virtual void SetPresenter(WebsiteSettings* presenter) OVERRIDE; virtual void SetPresenter(WebsiteSettings* presenter) OVERRIDE;
virtual void SetSiteInfo(const std::string& site_info) OVERRIDE;
virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE; virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE;
virtual void SetPermissionInfo( virtual void SetPermissionInfo(
const PermissionInfoList& permission_info_list) OVERRIDE; const PermissionInfoList& permission_info_list) OVERRIDE;
virtual void SetIdentityInfo(const IdentityInfo& identity_info) OVERRIDE;
// BubbleDelegateGtk implementation. // BubbleDelegateGtk implementation.
virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE;
...@@ -46,8 +46,11 @@ class WebsiteSettingsPopupGtk : public WebsiteSettingsUI, ...@@ -46,8 +46,11 @@ class WebsiteSettingsPopupGtk : public WebsiteSettingsUI,
// Removes all children of |container|. // Removes all children of |container|.
void ClearContainer(GtkWidget* container); void ClearContainer(GtkWidget* container);
// Creates a popup section and returns a virtual box that contains the section // Creates a label that contains the given |text| and has the given |width|.
// content. GtkWidget* CreateTextLabel(const std::string& text, int width);
// Creates a popup section and returns a virtual box that contains the
// section content.
GtkWidget* CreateSection(std::string section_title, GtkWidget* CreateSection(std::string section_title,
GtkWidget* section_content); GtkWidget* section_content);
...@@ -82,13 +85,18 @@ class WebsiteSettingsPopupGtk : public WebsiteSettingsUI, ...@@ -82,13 +85,18 @@ class WebsiteSettingsPopupGtk : public WebsiteSettingsUI,
// settings page in a new tab. // settings page in a new tab.
Browser* browser_; Browser* browser_;
// Container for the site info section content. // Container for the popup header content.
GtkWidget* site_info_contents_; GtkWidget* header_box_;
// Container for the cookies and site data section content. // Container for the cookies and site data section content.
GtkWidget* cookies_section_contents_; GtkWidget* cookies_section_contents_;
// Container for the permissions section content. // Container for the permissions section content.
GtkWidget* permissions_section_contents_; GtkWidget* permissions_section_contents_;
// Container for the identity tab content.
GtkWidget* identity_tab_contents_;
// The UI translates user actions to specific events and forwards them to the // The UI translates user actions to specific events and forwards them to the
// |presenter_|. The |presenter_| handles these events and updates the UI. // |presenter_|. The |presenter_| handles these events and updates the UI.
WebsiteSettings* presenter_; WebsiteSettings* presenter_;
......
...@@ -14,5 +14,10 @@ WebsiteSettingsUI::PermissionInfo::PermissionInfo() ...@@ -14,5 +14,10 @@ WebsiteSettingsUI::PermissionInfo::PermissionInfo()
default_setting(CONTENT_SETTING_DEFAULT) { default_setting(CONTENT_SETTING_DEFAULT) {
} }
WebsiteSettingsUI::IdentityInfo::IdentityInfo()
: identity_status(WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN),
connection_status(WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN) {
}
WebsiteSettingsUI::~WebsiteSettingsUI() { WebsiteSettingsUI::~WebsiteSettingsUI() {
} }
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "chrome/browser/website_settings.h"
#include "chrome/common/content_settings.h" #include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_types.h" #include "chrome/common/content_settings_types.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
...@@ -58,21 +59,40 @@ class WebsiteSettingsUI { ...@@ -58,21 +59,40 @@ class WebsiteSettingsUI {
ContentSetting default_setting; ContentSetting default_setting;
}; };
// |IdentityInfo| contains information about the site's identity and
// connection.
struct IdentityInfo {
IdentityInfo();
// The site's identity.
std::string site_identity;
// Status of the site's identity.
WebsiteSettings::SiteIdentityStatus identity_status;
// Textual description of the site's identity status that is displayed to
// the user.
std::string identity_status_description;
// Status of the site's connection.
WebsiteSettings::SiteConnectionStatus connection_status;
// Textual description of the site's connection status that is displayed to
// the user.
std::string connection_status_description;
};
virtual ~WebsiteSettingsUI(); virtual ~WebsiteSettingsUI();
// Sets the |presenter| of the WebsiteSettingsUI that is responsible for // Sets the |presenter| of the WebsiteSettingsUI that is responsible for
// setting the data to display in the UI. // setting the data to display in the UI.
virtual void SetPresenter(WebsiteSettings* presenter) = 0; virtual void SetPresenter(WebsiteSettings* presenter) = 0;
// Sets site information.
virtual void SetSiteInfo(const std::string& site_info) = 0;
// Sets cookie information. // Sets cookie information.
virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) = 0; virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) = 0;
// Sets permision information. // Sets permision information.
virtual void SetPermissionInfo( virtual void SetPermissionInfo(
const PermissionInfoList& permission_info_list) = 0; const PermissionInfoList& permission_info_list) = 0;
// Sets site identity information.
virtual void SetIdentityInfo(const IdentityInfo& identity_info) = 0;
}; };
class CookieInfoList : public std::vector<WebsiteSettingsUI::CookieInfo> { class CookieInfoList : public std::vector<WebsiteSettingsUI::CookieInfo> {
......
...@@ -84,31 +84,10 @@ WebsiteSettings::WebsiteSettings( ...@@ -84,31 +84,10 @@ WebsiteSettings::WebsiteSettings(
content_settings_(profile->GetHostContentSettingsMap()) { content_settings_(profile->GetHostContentSettingsMap()) {
ui_->SetPresenter(this); ui_->SetPresenter(this);
Init(profile, url, ssl); Init(profile, url, ssl);
// After initialization the status about the site's connection
// and it's identity must be available.
DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN);
DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN);
// TODO(markusheintz): Add the strings below to the grd file once a decision
// has been made about the exact wording.
std::string site_info;
switch (site_identity_status_) {
case WebsiteSettings::SITE_IDENTITY_STATUS_CERT:
case WebsiteSettings::SITE_IDENTITY_STATUS_DNSSEC_CERT:
site_info = "Identity verified";
break;
case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT:
site_info = UTF16ToUTF8(organization_name());
site_info += " - Identity verified";
break;
default:
site_info = "Identity not verified";
break;
}
ui_->SetSiteInfo(site_info);
PresentSitePermissions(); PresentSitePermissions();
PresentSiteData(); PresentSiteData();
PresentSiteIdentity();
} }
WebsiteSettings::~WebsiteSettings() { WebsiteSettings::~WebsiteSettings() {
...@@ -445,6 +424,26 @@ void WebsiteSettings::PresentSiteData() { ...@@ -445,6 +424,26 @@ void WebsiteSettings::PresentSiteData() {
ui_->SetCookieInfo(cookie_info_list); ui_->SetCookieInfo(cookie_info_list);
} }
void WebsiteSettings::PresentSiteIdentity() {
// After initialization the status about the site's connection
// and it's identity must be available.
DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN);
DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN);
WebsiteSettingsUI::IdentityInfo info;
if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT)
info.site_identity = UTF16ToUTF8(organization_name());
else
info.site_identity = site_url_.host();
info.connection_status = site_connection_status_;
info.connection_status_description =
UTF16ToUTF8(site_connection_details_);
info.identity_status = site_identity_status_;
info.identity_status_description =
UTF16ToUTF8(site_identity_details_);
ui_->SetIdentityInfo(info);
}
// static // static
void WebsiteSettings::Show(gfx::NativeWindow parent, void WebsiteSettings::Show(gfx::NativeWindow parent,
Profile* profile, Profile* profile,
......
...@@ -131,6 +131,10 @@ class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver { ...@@ -131,6 +131,10 @@ class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver {
// Sets (presents) the information about the site's data in the |ui_|. // Sets (presents) the information about the site's data in the |ui_|.
void PresentSiteData(); void PresentSiteData();
// Sets (presents) the information about the site's identity and connection
// in the |ui_|.
void PresentSiteIdentity();
// The website settings UI displays information and controls for site // The website settings UI displays information and controls for site
// specific data (local stored objects like cookies), site specific // specific data (local stored objects like cookies), site specific
// permissions (location, popup, plugin, etc. permissions) and site specific // permissions (location, popup, plugin, etc. permissions) and site specific
......
...@@ -57,10 +57,10 @@ class MockWebsiteSettingsUI : public WebsiteSettingsUI { ...@@ -57,10 +57,10 @@ class MockWebsiteSettingsUI : public WebsiteSettingsUI {
public: public:
virtual ~MockWebsiteSettingsUI() {} virtual ~MockWebsiteSettingsUI() {}
MOCK_METHOD1(SetPresenter, void(WebsiteSettings* presenter)); MOCK_METHOD1(SetPresenter, void(WebsiteSettings* presenter));
MOCK_METHOD1(SetSiteInfo, void(const std::string& site_info));
MOCK_METHOD1(SetCookieInfo, void(const CookieInfoList& cookie_info_list)); MOCK_METHOD1(SetCookieInfo, void(const CookieInfoList& cookie_info_list));
MOCK_METHOD1(SetPermissionInfo, MOCK_METHOD1(SetPermissionInfo,
void(const PermissionInfoList& permission_info_list)); void(const PermissionInfoList& permission_info_list));
MOCK_METHOD1(SetIdentityInfo, void(const IdentityInfo& identity_info));
}; };
class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness { class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness {
...@@ -115,7 +115,7 @@ class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness { ...@@ -115,7 +115,7 @@ class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness {
void SetDefaultUIExpectations(MockWebsiteSettingsUI* mock_ui) { void SetDefaultUIExpectations(MockWebsiteSettingsUI* mock_ui) {
// During creation |WebsiteSettings| makes the following calls to the ui. // During creation |WebsiteSettings| makes the following calls to the ui.
EXPECT_CALL(*mock_ui, SetPermissionInfo(_)); EXPECT_CALL(*mock_ui, SetPermissionInfo(_));
EXPECT_CALL(*mock_ui, SetSiteInfo(_)); EXPECT_CALL(*mock_ui, SetIdentityInfo(_));
EXPECT_CALL(*mock_ui, SetPresenter(_)); EXPECT_CALL(*mock_ui, SetPresenter(_));
EXPECT_CALL(*mock_ui, SetCookieInfo(_)); EXPECT_CALL(*mock_ui, SetCookieInfo(_));
} }
...@@ -202,7 +202,7 @@ TEST_F(WebsiteSettingsTest, OnPermissionsChanged) { ...@@ -202,7 +202,7 @@ TEST_F(WebsiteSettingsTest, OnPermissionsChanged) {
TEST_F(WebsiteSettingsTest, OnSiteDataAccessed) { TEST_F(WebsiteSettingsTest, OnSiteDataAccessed) {
EXPECT_CALL(*mock_ui(), SetPermissionInfo(_)); EXPECT_CALL(*mock_ui(), SetPermissionInfo(_));
EXPECT_CALL(*mock_ui(), SetSiteInfo(_)); EXPECT_CALL(*mock_ui(), SetIdentityInfo(_));
EXPECT_CALL(*mock_ui(), SetPresenter(_)); EXPECT_CALL(*mock_ui(), SetPresenter(_));
EXPECT_CALL(*mock_ui(), SetCookieInfo(_)).Times(2); EXPECT_CALL(*mock_ui(), SetCookieInfo(_)).Times(2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment