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

Side by Side Diff: chrome/browser/android/shortcut_helper_unittest.cc

Issue 672823002: Remove IsDIPEnabled from Screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dpi-cleanup-1
Patch Set: rebase Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/android/shortcut_helper.h" 5 #include "chrome/browser/android/shortcut_helper.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "ui/gfx/screen.h" 10 #include "ui/gfx/screen.h"
11 #include "ui/gfx/screen_type_delegate.h" 11 #include "ui/gfx/screen_type_delegate.h"
12 12
13 // A dummy implementation of gfx::Screen, since ShortcutHelper needs access to 13 // A dummy implementation of gfx::Screen, since ShortcutHelper needs access to
14 // a gfx::Display's device scale factor. 14 // a gfx::Display's device scale factor.
15 // This is inspired by web_contents_video_capture_device_unittest.cc 15 // This is inspired by web_contents_video_capture_device_unittest.cc
16 // A bug has been opened to merge all those mocks: http://crbug.com/417227 16 // A bug has been opened to merge all those mocks: http://crbug.com/417227
17 class FakeScreen : public gfx::Screen { 17 class FakeScreen : public gfx::Screen {
18 public: 18 public:
19 FakeScreen() : display_(0x1337, gfx::Rect(0, 0, 2560, 1440)) { 19 FakeScreen() : display_(0x1337, gfx::Rect(0, 0, 2560, 1440)) {
20 } 20 }
21 virtual ~FakeScreen() {} 21 virtual ~FakeScreen() {}
22 22
23 void SetDisplayDeviceScaleFactor(float device_scale_factor) { 23 void SetDisplayDeviceScaleFactor(float device_scale_factor) {
24 display_.set_device_scale_factor(device_scale_factor); 24 display_.set_device_scale_factor(device_scale_factor);
25 } 25 }
26 26
27 // gfx::Screen implementation (only what's needed for testing). 27 // gfx::Screen implementation (only what's needed for testing).
28 virtual bool IsDIPEnabled() override { return true; }
29 virtual gfx::Point GetCursorScreenPoint() override { return gfx::Point(); } 28 virtual gfx::Point GetCursorScreenPoint() override { return gfx::Point(); }
30 virtual gfx::NativeWindow GetWindowUnderCursor() override { return NULL; } 29 virtual gfx::NativeWindow GetWindowUnderCursor() override { return NULL; }
31 virtual gfx::NativeWindow GetWindowAtScreenPoint( 30 virtual gfx::NativeWindow GetWindowAtScreenPoint(
32 const gfx::Point& point) override { return NULL; } 31 const gfx::Point& point) override { return NULL; }
33 virtual int GetNumDisplays() const override { return 1; } 32 virtual int GetNumDisplays() const override { return 1; }
34 virtual std::vector<gfx::Display> GetAllDisplays() const override { 33 virtual std::vector<gfx::Display> GetAllDisplays() const override {
35 return std::vector<gfx::Display>(1, display_); 34 return std::vector<gfx::Display>(1, display_);
36 } 35 }
37 virtual gfx::Display GetDisplayNearestWindow( 36 virtual gfx::Display GetDisplayNearestWindow(
38 gfx::NativeView view) const override { 37 gfx::NativeView view) const override {
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 485
487 std::vector<content::Manifest::Icon> icons; 486 std::vector<content::Manifest::Icon> icons;
488 icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", 1.0, sizes)); 487 icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", 1.0, sizes));
489 icons.push_back(CreateIcon("http://foo.com/icon.png", "", 3.0, sizes)); 488 icons.push_back(CreateIcon("http://foo.com/icon.png", "", 3.0, sizes));
490 489
491 SetDisplayDeviceScaleFactor(3.0f); 490 SetDisplayDeviceScaleFactor(3.0f);
492 GURL url = FindBestMatchingIcon(icons); 491 GURL url = FindBestMatchingIcon(icons);
493 EXPECT_EQ("http://foo.com/icon.png", url.spec()); 492 EXPECT_EQ("http://foo.com/icon.png", url.spec());
494 } 493 }
495 } 494 }
OLDNEW
« no previous file with comments | « athena/env/athena_env_impl.cc ('k') | chrome/browser/extensions/api/system_display/system_display_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698