Index: chrome/browser/ui/webui/prefs_internals_browsertest.cc |
diff --git a/chrome/browser/ui/webui/prefs_internals_browsertest.cc b/chrome/browser/ui/webui/prefs_internals_browsertest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..59c372596a99831f71aee1a926e11689d748d0bd |
--- /dev/null |
+++ b/chrome/browser/ui/webui/prefs_internals_browsertest.cc |
@@ -0,0 +1,35 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/tabs/tab_strip_model.h" |
+#include "chrome/test/base/in_process_browser_test.h" |
+#include "chrome/test/base/ui_test_utils.h" |
+#include "content/public/browser/web_contents.h" |
+#include "content/public/test/browser_test_utils.h" |
+#include "url/gurl.h" |
+ |
+using PrefsInternalsTest = InProcessBrowserTest; |
+ |
+IN_PROC_BROWSER_TEST_F(PrefsInternalsTest, TestSomethingIsServed) { |
+ // First, check that navigation succeeds. |
+ GURL kUrl("chrome://prefs-internals"); |
+ ui_test_utils::NavigateToURL(browser(), kUrl); |
+ content::WebContents* web_contents = |
+ browser()->tab_strip_model()->GetActiveWebContents(); |
+ ASSERT_TRUE(web_contents); |
+ EXPECT_EQ(kUrl, web_contents->GetLastCommittedURL()); |
+ EXPECT_FALSE(web_contents->IsCrashed()); |
+ EXPECT_FALSE(web_contents->GetInterstitialPage()); |
+ |
+ // It's difficult to test the content of the page without duplicating the |
+ // implementation, but we can at least assert that something is being shown. |
Dan Beam
2017/03/08 18:40:58
why not just set a string pref to a very unique va
Devlin
2017/03/20 19:25:31
That's a good idea. Done. (Very unique value == b
|
+ bool has_text = false; |
+ EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
+ web_contents, |
+ "window.domAutomationController.send(" |
+ "document.body.textContent && document.body.textContent.length > 0);", |
+ &has_text)); |
+ EXPECT_TRUE(has_text); |
+} |