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

Side by Side Diff: chrome/browser/net/errorpage_test_util.cc

Issue 2913733002: Add a browser test for access control for file: scheme (Closed)
Patch Set: Rework the patch per feedback Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
mmenke 2017/06/05 18:31:34 --(c)
satorux1 2017/06/06 08:52:37 done - but this file is gone.
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/net/errorpage_test_util.h"
6
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/tabs/tab_strip_model.h"
9 #include "content/public/browser/web_contents.h"
10 #include "content/public/test/browser_test_utils.h"
11 #include "net/base/net_errors.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace errorpage_test_util {
15
16 bool IsDisplayingText(Browser* browser, const std::string& text) {
17 // clang-format off
18 std::string command = base::StringPrintf(R"(
19 function isNodeVisible(node) {
20 if (!node || node.classList.contains('hidden'))
21 return false;
22 if (!node.parentElement)
23 return true;
24 // Otherwise, we must check all parent nodes
25 return isNodeVisible(node.parentElement);
26 }
27 var node = document.evaluate("//*[contains(text(),'%s')]", document,
28 null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
29 domAutomationController.send(isNodeVisible(node));
30 )", text.c_str());
31 // clang-format on
32 bool result = false;
33 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
34 browser->tab_strip_model()->GetActiveWebContents(), command, &result));
35 return result;
36 }
37
38 } // namespace errorpage_test_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698