| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ui/views/website_settings/website_settings_popup_view.h
" | 5 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/browser/ui/views/website_settings/permission_selector_view.h" | 8 #include "chrome/browser/ui/views/website_settings/permission_selector_view.h" |
| 9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "content/public/common/ssl_status.h" | 10 #include "content/public/common/ssl_status.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 profile_(profile), | 27 profile_(profile), |
| 28 web_contents_(web_contents) { | 28 web_contents_(web_contents) { |
| 29 CreateView(); | 29 CreateView(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void CreateView() { | 32 void CreateView() { |
| 33 if (view_) | 33 if (view_) |
| 34 view_->GetWidget()->CloseNow(); | 34 view_->GetWidget()->CloseNow(); |
| 35 | 35 |
| 36 GURL url("http://www.example.com"); | 36 GURL url("http://www.example.com"); |
| 37 SecurityStateModel::SecurityInfo security_info; | 37 security_state::SecurityStateModel::SecurityInfo security_info; |
| 38 views::View* anchor_view = nullptr; | 38 views::View* anchor_view = nullptr; |
| 39 view_ = new WebsiteSettingsPopupView(anchor_view, parent_, profile_, | 39 view_ = new WebsiteSettingsPopupView(anchor_view, parent_, profile_, |
| 40 web_contents_, url, security_info); | 40 web_contents_, url, security_info); |
| 41 } | 41 } |
| 42 | 42 |
| 43 WebsiteSettingsPopupView* view() { return view_; } | 43 WebsiteSettingsPopupView* view() { return view_; } |
| 44 views::View* permissions_content() { return view_->permissions_content_; } | 44 views::View* permissions_content() { return view_->permissions_content_; } |
| 45 | 45 |
| 46 PermissionSelectorView* GetPermissionSelectorAt(int index) { | 46 PermissionSelectorView* GetPermissionSelectorAt(int index) { |
| 47 return static_cast<PermissionSelectorView*>( | 47 return static_cast<PermissionSelectorView*>( |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 api_->GetPermissionSelectorAt(0)->PermissionChanged(list.back()); | 175 api_->GetPermissionSelectorAt(0)->PermissionChanged(list.back()); |
| 176 EXPECT_EQ(1, api_->permissions_content()->child_count()); | 176 EXPECT_EQ(1, api_->permissions_content()->child_count()); |
| 177 EXPECT_EQ(base::ASCIIToUTF16("Ask by you"), | 177 EXPECT_EQ(base::ASCIIToUTF16("Ask by you"), |
| 178 api_->GetPermissionButtonAt(0)->GetText()); | 178 api_->GetPermissionButtonAt(0)->GetText()); |
| 179 | 179 |
| 180 // However, since the setting is now default, recreating the dialog with those | 180 // However, since the setting is now default, recreating the dialog with those |
| 181 // settings should omit the permission from the UI. | 181 // settings should omit the permission from the UI. |
| 182 api_->SetPermissionInfo(list); | 182 api_->SetPermissionInfo(list); |
| 183 EXPECT_EQ(0, api_->permissions_content()->child_count()); | 183 EXPECT_EQ(0, api_->permissions_content()->child_count()); |
| 184 } | 184 } |
| OLD | NEW |