OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "content/public/test/browser_test.h" | 9 #include "content/public/test/browser_test.h" |
10 #include "headless/public/devtools/domains/page.h" | 10 #include "headless/public/devtools/domains/page.h" |
| 11 #include "headless/public/devtools/domains/security.h" |
11 #include "headless/public/headless_browser.h" | 12 #include "headless/public/headless_browser.h" |
12 #include "headless/public/headless_devtools_client.h" | 13 #include "headless/public/headless_devtools_client.h" |
13 #include "headless/public/headless_web_contents.h" | 14 #include "headless/public/headless_web_contents.h" |
14 #include "headless/test/headless_browser_test.h" | 15 #include "headless/test/headless_browser_test.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
19 | 20 |
20 using testing::UnorderedElementsAre; | 21 using testing::UnorderedElementsAre; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 68 |
68 void OnScreenshotCaptured( | 69 void OnScreenshotCaptured( |
69 std::unique_ptr<page::CaptureScreenshotResult> result) { | 70 std::unique_ptr<page::CaptureScreenshotResult> result) { |
70 EXPECT_LT(0U, result->GetData().length()); | 71 EXPECT_LT(0U, result->GetData().length()); |
71 FinishAsynchronousTest(); | 72 FinishAsynchronousTest(); |
72 } | 73 } |
73 }; | 74 }; |
74 | 75 |
75 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessWebContentsScreenshotTest); | 76 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessWebContentsScreenshotTest); |
76 | 77 |
| 78 class HeadlessWebContentsSecurityTest |
| 79 : public HeadlessAsyncDevTooledBrowserTest, |
| 80 public security::ExperimentalObserver { |
| 81 public: |
| 82 void RunDevTooledTest() override { |
| 83 devtools_client_->GetSecurity()->GetExperimental()->AddObserver(this); |
| 84 devtools_client_->GetSecurity()->GetExperimental()->Enable( |
| 85 security::EnableParams::Builder().Build()); |
| 86 } |
| 87 |
| 88 void OnSecurityStateChanged( |
| 89 const security::SecurityStateChangedParams& params) override { |
| 90 EXPECT_EQ(security::SecurityState::NEUTRAL, params.GetSecurityState()); |
| 91 EXPECT_TRUE(params.HasExplanations()); |
| 92 |
| 93 FinishAsynchronousTest(); |
| 94 } |
| 95 }; |
| 96 |
| 97 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessWebContentsSecurityTest); |
| 98 |
77 } // namespace headless | 99 } // namespace headless |
OLD | NEW |