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

Side by Side Diff: chrome/browser/tab_contents/navigation_entry_unittest.cc

Issue 2067003: Track "display" and "run" separately for mixed content, and make the latter d... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/string16.h" 5 #include "base/string16.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "chrome/browser/renderer_host/site_instance.h" 7 #include "chrome/browser/renderer_host/site_instance.h"
8 #include "chrome/browser/tab_contents/navigation_entry.h" 8 #include "chrome/browser/tab_contents/navigation_entry.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 // Test SSLStatus inner class 96 // Test SSLStatus inner class
97 TEST_F(NavigationEntryTest, NavigationEntrySSLStatus) { 97 TEST_F(NavigationEntryTest, NavigationEntrySSLStatus) {
98 // Default (not secure) 98 // Default (not secure)
99 EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry1_.get()->ssl().security_style()); 99 EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry1_.get()->ssl().security_style());
100 EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry2_.get()->ssl().security_style()); 100 EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry2_.get()->ssl().security_style());
101 EXPECT_EQ(0, entry1_.get()->ssl().cert_id()); 101 EXPECT_EQ(0, entry1_.get()->ssl().cert_id());
102 EXPECT_EQ(0, entry1_.get()->ssl().cert_status()); 102 EXPECT_EQ(0, entry1_.get()->ssl().cert_status());
103 EXPECT_EQ(-1, entry1_.get()->ssl().security_bits()); 103 EXPECT_EQ(-1, entry1_.get()->ssl().security_bits());
104 EXPECT_FALSE(entry1_.get()->ssl().has_mixed_content()); 104 EXPECT_FALSE(entry1_.get()->ssl().displayed_mixed_content());
105 EXPECT_FALSE(entry1_.get()->ssl().ran_mixed_content());
105 106
106 // Change from the defaults 107 // Change from the defaults
107 entry2_.get()->ssl().set_security_style(SECURITY_STYLE_AUTHENTICATED); 108 entry2_.get()->ssl().set_security_style(SECURITY_STYLE_AUTHENTICATED);
108 entry2_.get()->ssl().set_cert_id(4); 109 entry2_.get()->ssl().set_cert_id(4);
109 entry2_.get()->ssl().set_cert_status(1); 110 entry2_.get()->ssl().set_cert_status(1);
110 entry2_.get()->ssl().set_security_bits(0); 111 entry2_.get()->ssl().set_security_bits(0);
112 entry2_.get()->ssl().set_displayed_mixed_content();
111 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, 113 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED,
112 entry2_.get()->ssl().security_style()); 114 entry2_.get()->ssl().security_style());
113 EXPECT_EQ(4, entry2_.get()->ssl().cert_id()); 115 EXPECT_EQ(4, entry2_.get()->ssl().cert_id());
114 EXPECT_EQ(1, entry2_.get()->ssl().cert_status()); 116 EXPECT_EQ(1, entry2_.get()->ssl().cert_status());
115 EXPECT_EQ(0, entry2_.get()->ssl().security_bits()); 117 EXPECT_EQ(0, entry2_.get()->ssl().security_bits());
118 EXPECT_TRUE(entry2_.get()->ssl().displayed_mixed_content());
116 119
117 // Mixed content unaffected by unsafe content 120 entry2_.get()->ssl().set_security_style(SECURITY_STYLE_AUTHENTICATION_BROKEN);
118 EXPECT_FALSE(entry2_.get()->ssl().has_mixed_content()); 121 entry2_.get()->ssl().set_ran_mixed_content();
119 entry2_.get()->ssl().set_has_mixed_content(); 122 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN,
120 EXPECT_TRUE(entry2_.get()->ssl().has_mixed_content()); 123 entry2_.get()->ssl().security_style());
124 EXPECT_TRUE(entry2_.get()->ssl().ran_mixed_content());
121 } 125 }
122 126
123 // Test other basic accessors 127 // Test other basic accessors
124 TEST_F(NavigationEntryTest, NavigationEntryAccessors) { 128 TEST_F(NavigationEntryTest, NavigationEntryAccessors) {
125 // SiteInstance 129 // SiteInstance
126 EXPECT_TRUE(entry1_.get()->site_instance() == NULL); 130 EXPECT_TRUE(entry1_.get()->site_instance() == NULL);
127 EXPECT_EQ(instance_, entry2_.get()->site_instance()); 131 EXPECT_EQ(instance_, entry2_.get()->site_instance());
128 entry1_.get()->set_site_instance(instance_); 132 entry1_.get()->set_site_instance(instance_);
129 EXPECT_EQ(instance_, entry1_.get()->site_instance()); 133 EXPECT_EQ(instance_, entry1_.get()->site_instance());
130 134
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 EXPECT_FALSE(entry2_.get()->has_post_data()); 173 EXPECT_FALSE(entry2_.get()->has_post_data());
170 entry2_.get()->set_has_post_data(true); 174 entry2_.get()->set_has_post_data(true);
171 EXPECT_TRUE(entry2_.get()->has_post_data()); 175 EXPECT_TRUE(entry2_.get()->has_post_data());
172 176
173 // Restored 177 // Restored
174 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type()); 178 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type());
175 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type()); 179 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type());
176 entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION); 180 entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION);
177 EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type()); 181 EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type());
178 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698