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