| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/test/base/testing_browser_process_test.h" | 8 #include "chrome/test/base/testing_browser_process_test.h" |
| 9 #include "content/browser/site_instance.h" | 9 #include "content/browser/site_instance.h" |
| 10 #include "content/browser/tab_contents/navigation_entry.h" | 10 #include "content/browser/tab_contents/navigation_entry.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 entry1_.get()->favicon().set_is_valid(true); | 99 entry1_.get()->favicon().set_is_valid(true); |
| 100 EXPECT_TRUE(entry1_.get()->favicon().is_valid()); | 100 EXPECT_TRUE(entry1_.get()->favicon().is_valid()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 // Test SSLStatus inner class | 103 // Test SSLStatus inner class |
| 104 TEST_F(NavigationEntryTest, NavigationEntrySSLStatus) { | 104 TEST_F(NavigationEntryTest, NavigationEntrySSLStatus) { |
| 105 // Default (unknown) | 105 // Default (unknown) |
| 106 EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry1_.get()->ssl().security_style()); | 106 EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry1_.get()->ssl().security_style()); |
| 107 EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry2_.get()->ssl().security_style()); | 107 EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry2_.get()->ssl().security_style()); |
| 108 EXPECT_EQ(0, entry1_.get()->ssl().cert_id()); | 108 EXPECT_EQ(0, entry1_.get()->ssl().cert_id()); |
| 109 EXPECT_EQ(0, entry1_.get()->ssl().cert_status()); | 109 EXPECT_EQ(net::CERT_STATUS_NO_ERROR, entry1_.get()->ssl().cert_status()); |
| 110 EXPECT_EQ(-1, entry1_.get()->ssl().security_bits()); | 110 EXPECT_EQ(-1, entry1_.get()->ssl().security_bits()); |
| 111 EXPECT_FALSE(entry1_.get()->ssl().displayed_insecure_content()); | 111 EXPECT_FALSE(entry1_.get()->ssl().displayed_insecure_content()); |
| 112 EXPECT_FALSE(entry1_.get()->ssl().ran_insecure_content()); | 112 EXPECT_FALSE(entry1_.get()->ssl().ran_insecure_content()); |
| 113 | 113 |
| 114 // Change from the defaults | 114 // Change from the defaults |
| 115 entry2_.get()->ssl().set_security_style(SECURITY_STYLE_AUTHENTICATED); | 115 entry2_.get()->ssl().set_security_style(SECURITY_STYLE_AUTHENTICATED); |
| 116 entry2_.get()->ssl().set_cert_id(4); | 116 entry2_.get()->ssl().set_cert_id(4); |
| 117 entry2_.get()->ssl().set_cert_status(1); | 117 entry2_.get()->ssl().set_cert_status(net::CERT_STATUS_COMMON_NAME_INVALID); |
| 118 entry2_.get()->ssl().set_security_bits(0); | 118 entry2_.get()->ssl().set_security_bits(0); |
| 119 entry2_.get()->ssl().set_displayed_insecure_content(); | 119 entry2_.get()->ssl().set_displayed_insecure_content(); |
| 120 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, | 120 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, |
| 121 entry2_.get()->ssl().security_style()); | 121 entry2_.get()->ssl().security_style()); |
| 122 EXPECT_EQ(4, entry2_.get()->ssl().cert_id()); | 122 EXPECT_EQ(4, entry2_.get()->ssl().cert_id()); |
| 123 EXPECT_EQ(1, entry2_.get()->ssl().cert_status()); | 123 EXPECT_EQ(net::CERT_STATUS_COMMON_NAME_INVALID, |
| 124 entry2_.get()->ssl().cert_status()); |
| 124 EXPECT_EQ(0, entry2_.get()->ssl().security_bits()); | 125 EXPECT_EQ(0, entry2_.get()->ssl().security_bits()); |
| 125 EXPECT_TRUE(entry2_.get()->ssl().displayed_insecure_content()); | 126 EXPECT_TRUE(entry2_.get()->ssl().displayed_insecure_content()); |
| 126 | 127 |
| 127 entry2_.get()->ssl().set_security_style(SECURITY_STYLE_AUTHENTICATION_BROKEN); | 128 entry2_.get()->ssl().set_security_style(SECURITY_STYLE_AUTHENTICATION_BROKEN); |
| 128 entry2_.get()->ssl().set_ran_insecure_content(); | 129 entry2_.get()->ssl().set_ran_insecure_content(); |
| 129 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, | 130 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, |
| 130 entry2_.get()->ssl().security_style()); | 131 entry2_.get()->ssl().security_style()); |
| 131 EXPECT_TRUE(entry2_.get()->ssl().ran_insecure_content()); | 132 EXPECT_TRUE(entry2_.get()->ssl().ran_insecure_content()); |
| 132 } | 133 } |
| 133 | 134 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 EXPECT_FALSE(entry2_.get()->has_post_data()); | 181 EXPECT_FALSE(entry2_.get()->has_post_data()); |
| 181 entry2_.get()->set_has_post_data(true); | 182 entry2_.get()->set_has_post_data(true); |
| 182 EXPECT_TRUE(entry2_.get()->has_post_data()); | 183 EXPECT_TRUE(entry2_.get()->has_post_data()); |
| 183 | 184 |
| 184 // Restored | 185 // Restored |
| 185 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type()); | 186 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type()); |
| 186 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type()); | 187 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type()); |
| 187 entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION); | 188 entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION); |
| 188 EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type()); | 189 EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type()); |
| 189 } | 190 } |
| OLD | NEW |