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

Unified Diff: chrome/browser/ui/profile_error_browsertest.cc

Issue 1284383007: ProfileErrorBrowserTest should wait for layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/profile_error_browsertest.cc
diff --git a/chrome/browser/ui/profile_error_browsertest.cc b/chrome/browser/ui/profile_error_browsertest.cc
index bc9d3073d92e208d3f1032c6e2f45d0fbb764bc3..e32e021bb83f151ac820ae10dce368ee9666d3ef 100644
--- a/chrome/browser/ui/profile_error_browsertest.cc
+++ b/chrome/browser/ui/profile_error_browsertest.cc
@@ -9,12 +9,15 @@
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/test/histogram_tester.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/simple_message_box_internal.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/test/browser_test_utils.h"
namespace {
@@ -83,6 +86,21 @@ IN_PROC_BROWSER_TEST_P(ProfileErrorBrowserTest, MAYBE_CorruptedProfile) {
// Navigate to a URL so the first non-empty paint is registered.
ui_test_utils::NavigateToURL(browser(), GURL("http://www.example.com/"));
+
+ content::WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+
+ // Wait for the page to produce a frame, the first visually non-empty paint
+ // metric is not valid until then.
+ bool loaded = false;
+ ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
+ contents,
+ "requestAnimationFrame(function() {"
+ " window.domAutomationController.send(true);"
+ "});",
+ &loaded));
+ ASSERT_TRUE(loaded);
+
if (do_corrupt_) {
histogram_tester_.ExpectTotalCount(kPaintHistogram, 0);
histogram_tester_.ExpectTotalCount(kLoadHistogram, 0);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698