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

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

Issue 2778983002: Fix browser tests on Mac (Closed)
Patch Set: nit change on #if defined on DefaultSizes test 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // TODO(irisu): Focus of two web contents should be independent of the other.
90 // Both web_contents and web_contents2 should be focused at this point. 90 // Both web_contents and web_contents2 should be focused at this point.
91 // NOTE(dvallet): Mac headless implementation already does this.
91 EXPECT_TRUE(EvaluateScript(web_contents, "document.hasFocus()") 92 EXPECT_TRUE(EvaluateScript(web_contents, "document.hasFocus()")
92 ->GetResult() 93 ->GetResult()
93 ->GetValue() 94 ->GetValue()
94 ->GetAsBoolean(&result)); 95 ->GetAsBoolean(&result));
96 #if !defined(OS_MACOSX)
95 EXPECT_FALSE(result); 97 EXPECT_FALSE(result);
98 #else
99 // Mac sets all contents as focused.
100 EXPECT_TRUE(result);
101 #endif
96 EXPECT_TRUE(EvaluateScript(web_contents2, "document.hasFocus()") 102 EXPECT_TRUE(EvaluateScript(web_contents2, "document.hasFocus()")
97 ->GetResult() 103 ->GetResult()
98 ->GetValue() 104 ->GetValue()
99 ->GetAsBoolean(&result)); 105 ->GetAsBoolean(&result));
100 EXPECT_TRUE(result); 106 EXPECT_TRUE(result);
101 } 107 }
102 108
103 namespace { 109 namespace {
104 bool DecodePNG(std::string base64_data, SkBitmap* bitmap) { 110 bool DecodePNG(std::string base64_data, SkBitmap* bitmap) {
105 std::string png_data; 111 std::string png_data;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 devtools_client_->GetSecurity()->GetExperimental()->Disable( 187 devtools_client_->GetSecurity()->GetExperimental()->Disable(
182 security::DisableParams::Builder().Build()); 188 security::DisableParams::Builder().Build());
183 devtools_client_->GetSecurity()->GetExperimental()->RemoveObserver(this); 189 devtools_client_->GetSecurity()->GetExperimental()->RemoveObserver(this);
184 FinishAsynchronousTest(); 190 FinishAsynchronousTest();
185 } 191 }
186 }; 192 };
187 193
188 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessWebContentsSecurityTest); 194 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessWebContentsSecurityTest);
189 195
190 } // namespace headless 196 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/headless_devtools_client_browsertest.cc ('k') | headless/public/headless_browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698