OLD | NEW |
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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 3023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); | 3034 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); |
3035 ASSERT_TRUE(bitmap.allocPixels()); | 3035 ASSERT_TRUE(bitmap.allocPixels()); |
3036 bitmap.eraseRGB(0, 0, 0); | 3036 bitmap.eraseRGB(0, 0, 0); |
3037 NavigationEntryImpl* entry; | 3037 NavigationEntryImpl* entry; |
3038 | 3038 |
3039 // Navigate enough times to make sure that some screenshots are purged. | 3039 // Navigate enough times to make sure that some screenshots are purged. |
3040 for (int i = 0; i < 12; ++i) { | 3040 for (int i = 0; i < 12; ++i) { |
3041 const GURL url(base::StringPrintf("http://foo%d/", i)); | 3041 const GURL url(base::StringPrintf("http://foo%d/", i)); |
3042 NavigateAndCommit(url); | 3042 NavigateAndCommit(url); |
3043 EXPECT_EQ(i, controller.GetCurrentEntryIndex()); | 3043 EXPECT_EQ(i, controller.GetCurrentEntryIndex()); |
3044 } | |
3045 | 3044 |
3046 for (int i = 0; i < controller.GetEntryCount(); ++i) { | |
3047 entry = NavigationEntryImpl::FromNavigationEntry( | 3045 entry = NavigationEntryImpl::FromNavigationEntry( |
3048 controller.GetEntryAtIndex(i)); | 3046 controller.GetEntryAtIndex(i)); |
3049 controller.OnScreenshotTaken(entry->GetUniqueID(), true, bitmap); | 3047 controller.OnScreenshotTaken(entry->GetUniqueID(), true, bitmap); |
3050 EXPECT_TRUE(entry->screenshot()); | 3048 EXPECT_TRUE(entry->screenshot()); |
3051 } | 3049 } |
3052 | |
3053 NavigateAndCommit(GURL("https://foo/")); | 3050 NavigateAndCommit(GURL("https://foo/")); |
3054 EXPECT_EQ(13, controller.GetEntryCount()); | 3051 EXPECT_EQ(13, controller.GetEntryCount()); |
3055 entry = NavigationEntryImpl::FromNavigationEntry( | 3052 entry = NavigationEntryImpl::FromNavigationEntry( |
3056 controller.GetEntryAtIndex(11)); | 3053 controller.GetEntryAtIndex(11)); |
3057 controller.OnScreenshotTaken(entry->GetUniqueID(), true, bitmap); | 3054 controller.OnScreenshotTaken(entry->GetUniqueID(), true, bitmap); |
3058 | 3055 |
3059 for (int i = 0; i < 2; ++i) { | 3056 for (int i = 0; i < 2; ++i) { |
3060 entry = NavigationEntryImpl::FromNavigationEntry( | 3057 entry = NavigationEntryImpl::FromNavigationEntry( |
3061 controller.GetEntryAtIndex(i)); | 3058 controller.GetEntryAtIndex(i)); |
3062 EXPECT_FALSE(entry->screenshot()) << "Screenshot " << i << " not purged"; | 3059 EXPECT_FALSE(entry->screenshot()) << "Screenshot " << i << " not purged"; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3285 PAGE_TRANSITION_LINK); | 3282 PAGE_TRANSITION_LINK); |
3286 session_helper_.AssertNavigationEquals(nav, | 3283 session_helper_.AssertNavigationEquals(nav, |
3287 windows_[0]->tabs[0]->navigations[0]); | 3284 windows_[0]->tabs[0]->navigations[0]); |
3288 nav.set_url(url2); | 3285 nav.set_url(url2); |
3289 session_helper_.AssertNavigationEquals(nav, | 3286 session_helper_.AssertNavigationEquals(nav, |
3290 windows_[0]->tabs[0]->navigations[1]); | 3287 windows_[0]->tabs[0]->navigations[1]); |
3291 } | 3288 } |
3292 */ | 3289 */ |
3293 | 3290 |
3294 } // namespace content | 3291 } // namespace content |
OLD | NEW |