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

Side by Side Diff: content/browser/devtools/protocol/devtools_protocol_browsertest.cc

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: tests Created 3 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "testing/gmock/include/gmock/gmock.h" 47 #include "testing/gmock/include/gmock/gmock.h"
48 #include "third_party/skia/include/core/SkBitmap.h" 48 #include "third_party/skia/include/core/SkBitmap.h"
49 #include "third_party/skia/include/core/SkColor.h" 49 #include "third_party/skia/include/core/SkColor.h"
50 #include "ui/base/layout.h" 50 #include "ui/base/layout.h"
51 #include "ui/compositor/compositor_switches.h" 51 #include "ui/compositor/compositor_switches.h"
52 #include "ui/gfx/codec/png_codec.h" 52 #include "ui/gfx/codec/png_codec.h"
53 #include "ui/gfx/geometry/rect.h" 53 #include "ui/gfx/geometry/rect.h"
54 #include "ui/gfx/geometry/size.h" 54 #include "ui/gfx/geometry/size.h"
55 #include "ui/gfx/skia_util.h" 55 #include "ui/gfx/skia_util.h"
56 56
57 #if defined(OS_ANDROID)
58 #include "content/browser/web_contents/web_contents_view.h"
59 #include "ui/android/view_root.h"
60 #endif
61
57 #define EXPECT_SIZE_EQ(expected, actual) \ 62 #define EXPECT_SIZE_EQ(expected, actual) \
58 do { \ 63 do { \
59 EXPECT_EQ((expected).width(), (actual).width()); \ 64 EXPECT_EQ((expected).width(), (actual).width()); \
60 EXPECT_EQ((expected).height(), (actual).height()); \ 65 EXPECT_EQ((expected).height(), (actual).height()); \
61 } while (false) 66 } while (false)
62 67
63 using testing::ElementsAre; 68 using testing::ElementsAre;
64 69
65 namespace content { 70 namespace content {
66 71
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 command_line->AppendSwitch(switches::kEnablePixelOutputInTests); 602 command_line->AppendSwitch(switches::kEnablePixelOutputInTests);
598 } 603 }
599 #endif 604 #endif
600 }; 605 };
601 606
602 IN_PROC_BROWSER_TEST_F(CaptureScreenshotTest, CaptureScreenshot) { 607 IN_PROC_BROWSER_TEST_F(CaptureScreenshotTest, CaptureScreenshot) {
603 // This test fails consistently on low-end Android devices. 608 // This test fails consistently on low-end Android devices.
604 // See crbug.com/653637. 609 // See crbug.com/653637.
605 if (base::SysInfo::IsLowEndDevice()) return; 610 if (base::SysInfo::IsLowEndDevice()) return;
606 611
612 #if defined(OS_ANDROID)
613 std::unique_ptr<ui::ViewRoot> view_root(new ui::ViewRoot());
boliu 2017/01/03 19:16:11 it's not clear to me why this test is special, we
Jinsuk Kim 2017/01/04 10:45:02 It was a wrong change added for temporary glitch.
614 WebContentsImpl* web_contents =
615 static_cast<WebContentsImpl*>(shell()->web_contents());
616 view_root->AddChild(web_contents->GetView()->GetNativeView());
617 #endif
618
607 shell()->LoadURL(GURL("about:blank")); 619 shell()->LoadURL(GURL("about:blank"));
608 Attach(); 620 Attach();
609 EXPECT_TRUE( 621 EXPECT_TRUE(
610 content::ExecuteScript(shell()->web_contents()->GetRenderViewHost(), 622 content::ExecuteScript(shell()->web_contents()->GetRenderViewHost(),
611 "document.body.style.background = '#123456'")); 623 "document.body.style.background = '#123456'"));
612 SkBitmap expected_bitmap; 624 SkBitmap expected_bitmap;
613 // We compare against the actual physical backing size rather than the 625 // We compare against the actual physical backing size rather than the
614 // view size, because the view size is stored adjusted for DPI and only in 626 // view size, because the view size is stored adjusted for DPI and only in
615 // integer precision. 627 // integer precision.
616 gfx::Size view_size = static_cast<RenderWidgetHostViewBase*>( 628 gfx::Size view_size = static_cast<RenderWidgetHostViewBase*>(
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 EXPECT_EQ("polyglottal", value); 1519 EXPECT_EQ("polyglottal", value);
1508 found++; 1520 found++;
1509 } else { 1521 } else {
1510 FAIL(); 1522 FAIL();
1511 } 1523 }
1512 } 1524 }
1513 EXPECT_EQ(2u, found); 1525 EXPECT_EQ(2u, found);
1514 } 1526 }
1515 1527
1516 } // namespace content 1528 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698