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

Side by Side Diff: ui/views/corewm/tooltip_controller_unittest.cc

Issue 1608733002: Remove ui/gfx/screen_type_delegate.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-4
Patch Set: and another rebase Created 4 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
« no previous file with comments | « ui/views/corewm/tooltip_controller.cc ('k') | ui/views/corewm/tooltip_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/views/corewm/tooltip_controller.h" 5 #include "ui/views/corewm/tooltip_controller.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/aura/client/cursor_client.h" 10 #include "ui/aura/client/cursor_client.h"
11 #include "ui/aura/client/screen_position_client.h" 11 #include "ui/aura/client/screen_position_client.h"
12 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
13 #include "ui/aura/test/aura_test_base.h" 13 #include "ui/aura/test/aura_test_base.h"
14 #include "ui/aura/test/test_screen.h" 14 #include "ui/aura/test/test_screen.h"
15 #include "ui/aura/test/test_window_delegate.h" 15 #include "ui/aura/test/test_window_delegate.h"
16 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
17 #include "ui/aura/window_event_dispatcher.h" 17 #include "ui/aura/window_event_dispatcher.h"
18 #include "ui/events/test/event_generator.h" 18 #include "ui/events/test/event_generator.h"
19 #include "ui/gfx/font.h" 19 #include "ui/gfx/font.h"
20 #include "ui/gfx/geometry/point.h" 20 #include "ui/gfx/geometry/point.h"
21 #include "ui/gfx/screen.h" 21 #include "ui/gfx/screen.h"
22 #include "ui/gfx/screen_type_delegate.h"
23 #include "ui/gfx/text_elider.h" 22 #include "ui/gfx/text_elider.h"
24 #include "ui/views/corewm/tooltip_aura.h" 23 #include "ui/views/corewm/tooltip_aura.h"
25 #include "ui/views/corewm/tooltip_controller_test_helper.h" 24 #include "ui/views/corewm/tooltip_controller_test_helper.h"
26 #include "ui/views/test/desktop_test_views_delegate.h" 25 #include "ui/views/test/desktop_test_views_delegate.h"
27 #include "ui/views/test/test_views_delegate.h" 26 #include "ui/views/test/test_views_delegate.h"
28 #include "ui/views/view.h" 27 #include "ui/views/view.h"
29 #include "ui/views/widget/tooltip_manager.h" 28 #include "ui/views/widget/tooltip_manager.h"
30 #include "ui/views/widget/widget.h" 29 #include "ui/views/widget/widget.h"
31 #include "ui/wm/core/default_activation_client.h" 30 #include "ui/wm/core/default_activation_client.h"
32 #include "ui/wm/core/default_screen_position_client.h" 31 #include "ui/wm/core/default_screen_position_client.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 public: 419 public:
421 TooltipControllerCaptureTest() {} 420 TooltipControllerCaptureTest() {}
422 ~TooltipControllerCaptureTest() override {} 421 ~TooltipControllerCaptureTest() override {}
423 422
424 void SetUp() override { 423 void SetUp() override {
425 TooltipControllerTest::SetUp(); 424 TooltipControllerTest::SetUp();
426 aura::client::SetScreenPositionClient(GetRootWindow(), 425 aura::client::SetScreenPositionClient(GetRootWindow(),
427 &screen_position_client_); 426 &screen_position_client_);
428 #if !defined(OS_CHROMEOS) 427 #if !defined(OS_CHROMEOS)
429 desktop_screen_.reset(CreateDesktopScreen()); 428 desktop_screen_.reset(CreateDesktopScreen());
430 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, 429 gfx::Screen::SetScreenInstance(desktop_screen_.get());
431 desktop_screen_.get());
432 #endif 430 #endif
433 } 431 }
434 432
435 void TearDown() override { 433 void TearDown() override {
436 #if !defined(OS_CHROMEOS) 434 #if !defined(OS_CHROMEOS)
437 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen()); 435 gfx::Screen::SetScreenInstance(test_screen());
438 desktop_screen_.reset(); 436 desktop_screen_.reset();
439 #endif 437 #endif
440 aura::client::SetScreenPositionClient(GetRootWindow(), NULL); 438 aura::client::SetScreenPositionClient(GetRootWindow(), NULL);
441 TooltipControllerTest::TearDown(); 439 TooltipControllerTest::TearDown();
442 } 440 }
443 441
444 private: 442 private:
445 wm::DefaultScreenPositionClient screen_position_client_; 443 wm::DefaultScreenPositionClient screen_position_client_;
446 scoped_ptr<gfx::Screen> desktop_screen_; 444 scoped_ptr<gfx::Screen> desktop_screen_;
447 445
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 namespace { 525 namespace {
528 526
529 class TestTooltip : public Tooltip { 527 class TestTooltip : public Tooltip {
530 public: 528 public:
531 TestTooltip() : is_visible_(false) {} 529 TestTooltip() : is_visible_(false) {}
532 ~TestTooltip() override {} 530 ~TestTooltip() override {}
533 531
534 const base::string16& tooltip_text() const { return tooltip_text_; } 532 const base::string16& tooltip_text() const { return tooltip_text_; }
535 533
536 // Tooltip: 534 // Tooltip:
537 int GetMaxWidth(const gfx::Point& location, 535 int GetMaxWidth(const gfx::Point& location) const override {
538 aura::Window* context) const override {
539 return 100; 536 return 100;
540 } 537 }
541 void SetText(aura::Window* window, 538 void SetText(aura::Window* window,
542 const base::string16& tooltip_text, 539 const base::string16& tooltip_text,
543 const gfx::Point& location) override { 540 const gfx::Point& location) override {
544 tooltip_text_ = tooltip_text; 541 tooltip_text_ = tooltip_text;
545 location_ = location; 542 location_ = location;
546 } 543 }
547 void Show() override { is_visible_ = true; } 544 void Show() override { is_visible_ = true; }
548 void Hide() override { is_visible_ = false; } 545 void Hide() override { is_visible_ = false; }
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 helper_->FireTooltipTimer(); 795 helper_->FireTooltipTimer();
799 tooltip_bounds1 = test_tooltip_->location(); 796 tooltip_bounds1 = test_tooltip_->location();
800 797
801 EXPECT_NE(tooltip_bounds1_1, tooltip_bounds1); 798 EXPECT_NE(tooltip_bounds1_1, tooltip_bounds1);
802 EXPECT_EQ(reference_string, helper_->GetTooltipText()); 799 EXPECT_EQ(reference_string, helper_->GetTooltipText());
803 } 800 }
804 801
805 } // namespace test 802 } // namespace test
806 } // namespace corewm 803 } // namespace corewm
807 } // namespace views 804 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/tooltip_controller.cc ('k') | ui/views/corewm/tooltip_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698