 Chromium Code Reviews
 Chromium Code Reviews Issue 2660873002:
  Move two utility functions from ash/screen_util.h to ui/wm/core/coordinate_conversion.h  (Closed)
    
  
    Issue 2660873002:
  Move two utility functions from ash/screen_util.h to ui/wm/core/coordinate_conversion.h  (Closed) 
  | Index: ui/wm/core/coordinate_conversion_unittest.cc | 
| diff --git a/ui/wm/core/coordinate_conversion_unittest.cc b/ui/wm/core/coordinate_conversion_unittest.cc | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..931b7e716f9468da70b99cef098077b6f0cd1876 | 
| --- /dev/null | 
| +++ b/ui/wm/core/coordinate_conversion_unittest.cc | 
| @@ -0,0 +1,38 @@ | 
| +// Copyright 2016 The Chromium Authors. All rights reserved. | 
| 
oshima
2017/01/30 19:16:14
nit: 2017
 
yhanada
2017/01/31 06:34:34
Done.
 | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#include "ui/wm/core/coordinate_conversion.h" | 
| + | 
| +#include <memory> | 
| 
oshima
2017/01/30 19:16:14
is this necessary?
 
yhanada
2017/01/31 06:34:34
Done.
 | 
| + | 
| +#include "base/macros.h" | 
| +#include "base/memory/ptr_util.h" | 
| 
oshima
2017/01/30 19:16:14
and these?
 
yhanada
2017/01/31 06:34:34
Done.
 | 
| +#include "testing/gtest/include/gtest/gtest.h" | 
| +#include "ui/aura/client/screen_position_client.h" | 
| +#include "ui/aura/test/aura_test_base.h" | 
| +#include "ui/aura/test/test_windows.h" | 
| +#include "ui/wm/core/default_screen_position_client.h" | 
| + | 
| +namespace wm { | 
| + | 
| +typedef aura::test::AuraTestBase CoordinateConversionTest; | 
| + | 
| +TEST_F(CoordinateConversionTest, ConvertRect) { | 
| + DefaultScreenPositionClient screen_position_client; | 
| + aura::client::SetScreenPositionClient(root_window(), &screen_position_client); | 
| + aura::Window* w = aura::test::CreateTestWindowWithBounds( | 
| + gfx::Rect(10, 20, 100, 200), root_window()); | 
| + | 
| + EXPECT_EQ("0,0 100x120", | 
| + ConvertRectFromScreen(w, gfx::Rect(10, 20, 100, 120)).ToString()); | 
| + EXPECT_EQ("-10,-20 100x200", | 
| + ConvertRectFromScreen(w, gfx::Rect(0, 0, 100, 200)).ToString()); | 
| + EXPECT_EQ("40,50 100x200", | 
| + ConvertRectToScreen(w, gfx::Rect(30, 30, 100, 200)).ToString()); | 
| + EXPECT_EQ("0,0 100x200", | 
| + ConvertRectToScreen(w, gfx::Rect(-10, -20, 100, 200)).ToString()); | 
| + aura::client::SetScreenPositionClient(root_window(), nullptr); | 
| +} | 
| + | 
| +} // namespace wm |