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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_unittest.cc

Issue 593503003: Support error handling for Surface readbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted code and fixed build issue in test. 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 ~MockScreenshotManager() override {} 76 ~MockScreenshotManager() override {}
77 77
78 void TakeScreenshotFor(content::NavigationEntryImpl* entry) { 78 void TakeScreenshotFor(content::NavigationEntryImpl* entry) {
79 SkBitmap bitmap; 79 SkBitmap bitmap;
80 bitmap.allocPixels(SkImageInfo::Make( 80 bitmap.allocPixels(SkImageInfo::Make(
81 1, 1, kAlpha_8_SkColorType, kPremul_SkAlphaType)); 81 1, 1, kAlpha_8_SkColorType, kPremul_SkAlphaType));
82 bitmap.eraseARGB(0, 0, 0, 0); 82 bitmap.eraseARGB(0, 0, 0, 0);
83 encoding_screenshot_in_progress_ = true; 83 encoding_screenshot_in_progress_ = true;
84 OnScreenshotTaken(entry->GetUniqueID(), true, bitmap); 84 OnScreenshotTaken(entry->GetUniqueID(), bitmap, content::READBACK_SUCCESS);
85 WaitUntilScreenshotIsReady(); 85 WaitUntilScreenshotIsReady();
86 } 86 }
87 87
88 int GetScreenshotCount() { 88 int GetScreenshotCount() {
89 return content::NavigationEntryScreenshotManager::GetScreenshotCount(); 89 return content::NavigationEntryScreenshotManager::GetScreenshotCount();
90 } 90 }
91 91
92 void WaitUntilScreenshotIsReady() { 92 void WaitUntilScreenshotIsReady() {
93 if (!encoding_screenshot_in_progress_) 93 if (!encoding_screenshot_in_progress_)
94 return; 94 return;
(...skipping 4294 matching lines...) Expand 10 before | Expand all | Expand 10 after
4389 params.post_id = -1; 4389 params.post_id = -1;
4390 contents()->GetMainFrame()->SendNavigateWithParams(&params); 4390 contents()->GetMainFrame()->SendNavigateWithParams(&params);
4391 4391
4392 // Now reload. replaceState overrides the POST, so we should not show a 4392 // Now reload. replaceState overrides the POST, so we should not show a
4393 // repost warning dialog. 4393 // repost warning dialog.
4394 controller_impl().Reload(true); 4394 controller_impl().Reload(true);
4395 EXPECT_EQ(0, delegate->repost_form_warning_count()); 4395 EXPECT_EQ(0, delegate->repost_form_warning_count());
4396 } 4396 }
4397 4397
4398 } // namespace content 4398 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698