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

Side by Side Diff: chrome/browser/ui/website_settings/website_settings_unittest.cc

Issue 681823004: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/website_settings/website_settings.h" 5 #include "chrome/browser/ui/website_settings/website_settings.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void(const PermissionInfoList& permission_info_list)); 66 void(const PermissionInfoList& permission_info_list));
67 MOCK_METHOD1(SetIdentityInfo, void(const IdentityInfo& identity_info)); 67 MOCK_METHOD1(SetIdentityInfo, void(const IdentityInfo& identity_info));
68 MOCK_METHOD1(SetFirstVisit, void(const base::string16& first_visit)); 68 MOCK_METHOD1(SetFirstVisit, void(const base::string16& first_visit));
69 MOCK_METHOD1(SetSelectedTab, void(TabId tab_id)); 69 MOCK_METHOD1(SetSelectedTab, void(TabId tab_id));
70 }; 70 };
71 71
72 class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness { 72 class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness {
73 public: 73 public:
74 WebsiteSettingsTest() : cert_id_(0), url_("http://www.example.com") {} 74 WebsiteSettingsTest() : cert_id_(0), url_("http://www.example.com") {}
75 75
76 virtual ~WebsiteSettingsTest() { 76 ~WebsiteSettingsTest() override {}
77 }
78 77
79 virtual void SetUp() { 78 void SetUp() override {
80 ChromeRenderViewHostTestHarness::SetUp(); 79 ChromeRenderViewHostTestHarness::SetUp();
81 // Setup stub SSLStatus. 80 // Setup stub SSLStatus.
82 ssl_.security_style = content::SECURITY_STYLE_UNAUTHENTICATED; 81 ssl_.security_style = content::SECURITY_STYLE_UNAUTHENTICATED;
83 82
84 // Create the certificate. 83 // Create the certificate.
85 cert_id_ = 1; 84 cert_id_ = 1;
86 base::Time start_date = base::Time::Now(); 85 base::Time start_date = base::Time::Now();
87 base::Time expiration_date = base::Time::FromInternalValue( 86 base::Time expiration_date = base::Time::FromInternalValue(
88 start_date.ToInternalValue() + base::Time::kMicrosecondsPerWeek); 87 start_date.ToInternalValue() + base::Time::kMicrosecondsPerWeek);
89 cert_ = new net::X509Certificate("subject", 88 cert_ = new net::X509Certificate("subject",
90 "issuer", 89 "issuer",
91 start_date, 90 start_date,
92 expiration_date); 91 expiration_date);
93 92
94 TabSpecificContentSettings::CreateForWebContents(web_contents()); 93 TabSpecificContentSettings::CreateForWebContents(web_contents());
95 InfoBarService::CreateForWebContents(web_contents()); 94 InfoBarService::CreateForWebContents(web_contents());
96 95
97 // Setup the mock cert store. 96 // Setup the mock cert store.
98 EXPECT_CALL(cert_store_, RetrieveCert(cert_id_, _) ) 97 EXPECT_CALL(cert_store_, RetrieveCert(cert_id_, _) )
99 .Times(AnyNumber()) 98 .Times(AnyNumber())
100 .WillRepeatedly(DoAll(SetArgPointee<1>(cert_), Return(true))); 99 .WillRepeatedly(DoAll(SetArgPointee<1>(cert_), Return(true)));
101 100
102 // Setup mock ui. 101 // Setup mock ui.
103 mock_ui_.reset(new MockWebsiteSettingsUI()); 102 mock_ui_.reset(new MockWebsiteSettingsUI());
104 } 103 }
105 104
106 virtual void TearDown() { 105 void TearDown() override {
107 ASSERT_TRUE(website_settings_.get()) 106 ASSERT_TRUE(website_settings_.get())
108 << "No WebsiteSettings instance created."; 107 << "No WebsiteSettings instance created.";
109 RenderViewHostTestHarness::TearDown(); 108 RenderViewHostTestHarness::TearDown();
110 website_settings_.reset(); 109 website_settings_.reset();
111 } 110 }
112 111
113 void SetDefaultUIExpectations(MockWebsiteSettingsUI* mock_ui) { 112 void SetDefaultUIExpectations(MockWebsiteSettingsUI* mock_ui) {
114 // During creation |WebsiteSettings| makes the following calls to the ui. 113 // During creation |WebsiteSettings| makes the following calls to the ui.
115 EXPECT_CALL(*mock_ui, SetPermissionInfo(_)); 114 EXPECT_CALL(*mock_ui, SetPermissionInfo(_));
116 EXPECT_CALL(*mock_ui, SetIdentityInfo(_)); 115 EXPECT_CALL(*mock_ui, SetIdentityInfo(_));
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 405
407 TEST_F(WebsiteSettingsTest, InternalPage) { 406 TEST_F(WebsiteSettingsTest, InternalPage) {
408 SetURL("chrome://bookmarks"); 407 SetURL("chrome://bookmarks");
409 SetDefaultUIExpectations(mock_ui()); 408 SetDefaultUIExpectations(mock_ui());
410 EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE, 409 EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE,
411 website_settings()->site_connection_status()); 410 website_settings()->site_connection_status());
412 EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE, 411 EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE,
413 website_settings()->site_identity_status()); 412 website_settings()->site_identity_status());
414 EXPECT_EQ(base::string16(), website_settings()->organization_name()); 413 EXPECT_EQ(base::string16(), website_settings()->organization_name());
415 } 414 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698