OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/ui/browser.h" | |
6 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
7 #include "chrome/test/base/in_process_browser_test.h" | |
8 #include "chrome/test/base/ui_test_utils.h" | |
9 #include "content/public/browser/web_contents.h" | |
10 #include "content/public/test/browser_test_utils.h" | |
11 #include "url/gurl.h" | |
12 | |
13 using PrefsInternalsTest = InProcessBrowserTest; | |
14 | |
15 IN_PROC_BROWSER_TEST_F(PrefsInternalsTest, TestSomethingIsServed) { | |
16 // First, check that navigation succeeds. | |
17 GURL kUrl("chrome://prefs-internals"); | |
18 ui_test_utils::NavigateToURL(browser(), kUrl); | |
19 content::WebContents* web_contents = | |
20 browser()->tab_strip_model()->GetActiveWebContents(); | |
21 ASSERT_TRUE(web_contents); | |
22 EXPECT_EQ(kUrl, web_contents->GetLastCommittedURL()); | |
23 EXPECT_FALSE(web_contents->IsCrashed()); | |
24 EXPECT_FALSE(web_contents->GetInterstitialPage()); | |
25 | |
26 // It's difficult to test the content of the page without duplicating the | |
27 // 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
| |
28 bool has_text = false; | |
29 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | |
30 web_contents, | |
31 "window.domAutomationController.send(" | |
32 "document.body.textContent && document.body.textContent.length > 0);", | |
33 &has_text)); | |
34 EXPECT_TRUE(has_text); | |
35 } | |
OLD | NEW |