Chromium Code Reviews| 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 "content/browser/site_instance.h" | 8 #include "content/browser/site_instance.h" |
| 9 #include "content/browser/tab_contents/navigation_entry.h" | 9 #include "content/browser/tab_contents/navigation_entry.h" |
| 10 #include "chrome/test/testing_browser_process_test.h" | |
|
sky
2011/07/28 00:28:03
nit: before content
| |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 12 |
| 12 class NavigationEntryTest : public testing::Test { | 13 class NavigationEntryTest : public TestingBrowserProcessTest { |
| 13 public: | 14 public: |
| 14 NavigationEntryTest() : instance_(NULL) { | 15 NavigationEntryTest() : instance_(NULL) { |
| 15 } | 16 } |
| 16 | 17 |
| 17 virtual void SetUp() { | 18 virtual void SetUp() { |
| 18 entry1_.reset(new NavigationEntry); | 19 entry1_.reset(new NavigationEntry); |
| 19 | 20 |
| 20 instance_ = SiteInstance::CreateSiteInstance(NULL); | 21 instance_ = SiteInstance::CreateSiteInstance(NULL); |
| 21 entry2_.reset(new NavigationEntry(instance_, 3, | 22 entry2_.reset(new NavigationEntry(instance_, 3, |
| 22 GURL("test:url"), | 23 GURL("test:url"), |
| 23 GURL("from"), | 24 GURL("from"), |
| 24 ASCIIToUTF16("title"), | 25 ASCIIToUTF16("title"), |
| 25 PageTransition::TYPED)); | 26 PageTransition::TYPED)); |
| 26 } | 27 } |
| 27 | 28 |
| 28 virtual void TearDown() { | |
| 29 } | |
| 30 | |
| 31 protected: | 29 protected: |
| 32 scoped_ptr<NavigationEntry> entry1_; | 30 scoped_ptr<NavigationEntry> entry1_; |
| 33 scoped_ptr<NavigationEntry> entry2_; | 31 scoped_ptr<NavigationEntry> entry2_; |
| 34 // SiteInstances are deleted when their NavigationEntries are gone. | 32 // SiteInstances are deleted when their NavigationEntries are gone. |
| 35 SiteInstance* instance_; | 33 SiteInstance* instance_; |
| 36 }; | 34 }; |
| 37 | 35 |
| 38 // Test unique ID accessors | 36 // Test unique ID accessors |
| 39 TEST_F(NavigationEntryTest, NavigationEntryUniqueIDs) { | 37 TEST_F(NavigationEntryTest, NavigationEntryUniqueIDs) { |
| 40 // Two entries should have different IDs by default | 38 // Two entries should have different IDs by default |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 EXPECT_FALSE(entry2_.get()->has_post_data()); | 177 EXPECT_FALSE(entry2_.get()->has_post_data()); |
| 180 entry2_.get()->set_has_post_data(true); | 178 entry2_.get()->set_has_post_data(true); |
| 181 EXPECT_TRUE(entry2_.get()->has_post_data()); | 179 EXPECT_TRUE(entry2_.get()->has_post_data()); |
| 182 | 180 |
| 183 // Restored | 181 // Restored |
| 184 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type()); | 182 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type()); |
| 185 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type()); | 183 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type()); |
| 186 entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION); | 184 entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION); |
| 187 EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type()); | 185 EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type()); |
| 188 } | 186 } |
| OLD | NEW |