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

Side by Side Diff: headless/lib/headless_web_contents_browsertest.cc

Issue 2787373002: [headless] Use individual aura::WindowTreeHosts per WebContents. (Closed)
Patch Set: Created 3 years, 8 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
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 "base/base64.h" 9 #include "base/base64.h"
10 #include "content/public/test/browser_test.h" 10 #include "content/public/test/browser_test.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 ->GetValue() 79 ->GetValue()
80 ->GetAsBoolean(&result)); 80 ->GetAsBoolean(&result));
81 EXPECT_TRUE(result); 81 EXPECT_TRUE(result);
82 82
83 HeadlessWebContents* web_contents2 = 83 HeadlessWebContents* web_contents2 =
84 browser_context->CreateWebContentsBuilder() 84 browser_context->CreateWebContentsBuilder()
85 .SetInitialURL(embedded_test_server()->GetURL("/hello.html")) 85 .SetInitialURL(embedded_test_server()->GetURL("/hello.html"))
86 .Build(); 86 .Build();
87 EXPECT_TRUE(WaitForLoad(web_contents2)); 87 EXPECT_TRUE(WaitForLoad(web_contents2));
88 88
89 // TODO(irisu): Focus of two web contents should be independent of the other. 89 // Focus of different WebContents is independent.
90 // Both web_contents and web_contents2 should be focused at this point.
91 // NOTE(dvallet): Mac headless implementation already does this.
92 EXPECT_TRUE(EvaluateScript(web_contents, "document.hasFocus()") 90 EXPECT_TRUE(EvaluateScript(web_contents, "document.hasFocus()")
93 ->GetResult() 91 ->GetResult()
94 ->GetValue() 92 ->GetValue()
95 ->GetAsBoolean(&result)); 93 ->GetAsBoolean(&result));
96 #if !defined(OS_MACOSX)
97 EXPECT_FALSE(result);
98 #else
99 // Mac sets all contents as focused.
100 EXPECT_TRUE(result); 94 EXPECT_TRUE(result);
101 #endif
102 EXPECT_TRUE(EvaluateScript(web_contents2, "document.hasFocus()") 95 EXPECT_TRUE(EvaluateScript(web_contents2, "document.hasFocus()")
103 ->GetResult() 96 ->GetResult()
104 ->GetValue() 97 ->GetValue()
105 ->GetAsBoolean(&result)); 98 ->GetAsBoolean(&result));
106 EXPECT_TRUE(result); 99 EXPECT_TRUE(result);
107 } 100 }
108 101
109 namespace { 102 namespace {
110 bool DecodePNG(std::string base64_data, SkBitmap* bitmap) { 103 bool DecodePNG(std::string base64_data, SkBitmap* bitmap) {
111 std::string png_data; 104 std::string png_data;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 devtools_client_->GetSecurity()->GetExperimental()->Disable( 180 devtools_client_->GetSecurity()->GetExperimental()->Disable(
188 security::DisableParams::Builder().Build()); 181 security::DisableParams::Builder().Build());
189 devtools_client_->GetSecurity()->GetExperimental()->RemoveObserver(this); 182 devtools_client_->GetSecurity()->GetExperimental()->RemoveObserver(this);
190 FinishAsynchronousTest(); 183 FinishAsynchronousTest();
191 } 184 }
192 }; 185 };
193 186
194 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessWebContentsSecurityTest); 187 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessWebContentsSecurityTest);
195 188
196 } // namespace headless 189 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698