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

Side by Side Diff: ui/aura/mus/property_converter_unittest.cc

Issue 2632543003: Refactor and push window properties up to class properties. (Closed)
Patch Set: More build fixes Created 3 years, 10 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 "ui/aura/mus/property_converter.h" 5 #include "ui/aura/mus/property_converter.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "services/ui/public/cpp/property_type_converters.h" 13 #include "services/ui/public/cpp/property_type_converters.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "ui/aura/client/aura_constants.h" 15 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/test/aura_test_base.h" 16 #include "ui/aura/test/aura_test_base.h"
17 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
18 #include "ui/aura/window_property.h" 18 #include "ui/base/class_property.h"
19 #include "ui/gfx/geometry/rect.h" 19 #include "ui/gfx/geometry/rect.h"
20 #include "ui/gfx/image/image_skia.h" 20 #include "ui/gfx/image/image_skia.h"
21 #include "ui/gfx/skia_util.h" 21 #include "ui/gfx/skia_util.h"
22 22
23 // See aura_constants.cc for bool, int32_t, int64_t, std::string, gfx::Rect, 23 // See aura_constants.cc for bool, int32_t, int64_t, std::string, gfx::Rect,
24 // base::string16, uint32_t (via SkColor), and gfx::ImageSkia. 24 // base::string16, uint32_t (via SkColor), and gfx::ImageSkia.
25 DECLARE_WINDOW_PROPERTY_TYPE(uint8_t) 25 DECLARE_UI_CLASS_PROPERTY_TYPE(uint8_t)
26 DECLARE_WINDOW_PROPERTY_TYPE(uint16_t) 26 DECLARE_UI_CLASS_PROPERTY_TYPE(uint16_t)
27 DECLARE_WINDOW_PROPERTY_TYPE(uint64_t) 27 DECLARE_UI_CLASS_PROPERTY_TYPE(uint64_t)
28 DECLARE_WINDOW_PROPERTY_TYPE(int8_t) 28 DECLARE_UI_CLASS_PROPERTY_TYPE(int8_t)
29 DECLARE_WINDOW_PROPERTY_TYPE(int16_t) 29 DECLARE_UI_CLASS_PROPERTY_TYPE(int16_t)
30 30
31 namespace aura { 31 namespace aura {
32 32
33 namespace { 33 namespace {
34 34
35 DEFINE_WINDOW_PROPERTY_KEY(bool, kTestPropertyKey0, false); 35 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kTestPropertyKey0, false);
36 DEFINE_WINDOW_PROPERTY_KEY(bool, kTestPropertyKey1, true); 36 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kTestPropertyKey1, true);
37 DEFINE_WINDOW_PROPERTY_KEY(uint8_t, kTestPropertyKey2, UINT8_MAX / 3); 37 DEFINE_UI_CLASS_PROPERTY_KEY(uint8_t, kTestPropertyKey2, UINT8_MAX / 3);
38 DEFINE_WINDOW_PROPERTY_KEY(uint16_t, kTestPropertyKey3, UINT16_MAX / 3); 38 DEFINE_UI_CLASS_PROPERTY_KEY(uint16_t, kTestPropertyKey3, UINT16_MAX / 3);
39 DEFINE_WINDOW_PROPERTY_KEY(uint32_t, kTestPropertyKey4, UINT32_MAX); 39 DEFINE_UI_CLASS_PROPERTY_KEY(uint32_t, kTestPropertyKey4, UINT32_MAX);
40 DEFINE_WINDOW_PROPERTY_KEY(uint64_t, kTestPropertyKey5, UINT64_MAX); 40 DEFINE_UI_CLASS_PROPERTY_KEY(uint64_t, kTestPropertyKey5, UINT64_MAX);
41 DEFINE_WINDOW_PROPERTY_KEY(int8_t, kTestPropertyKey6, 0); 41 DEFINE_UI_CLASS_PROPERTY_KEY(int8_t, kTestPropertyKey6, 0);
42 DEFINE_WINDOW_PROPERTY_KEY(int16_t, kTestPropertyKey7, 1); 42 DEFINE_UI_CLASS_PROPERTY_KEY(int16_t, kTestPropertyKey7, 1);
43 DEFINE_WINDOW_PROPERTY_KEY(int32_t, kTestPropertyKey8, -1); 43 DEFINE_UI_CLASS_PROPERTY_KEY(int32_t, kTestPropertyKey8, -1);
44 DEFINE_WINDOW_PROPERTY_KEY(int64_t, kTestPropertyKey9, 777); 44 DEFINE_UI_CLASS_PROPERTY_KEY(int64_t, kTestPropertyKey9, 777);
45 45
46 DEFINE_OWNED_WINDOW_PROPERTY_KEY(gfx::ImageSkia, kTestImagePropertyKey, 46 DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(gfx::ImageSkia, kTestImagePropertyKey,
47 nullptr); 47 nullptr);
48 DEFINE_OWNED_WINDOW_PROPERTY_KEY(gfx::Rect, kTestRectPropertyKey, nullptr); 48 DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(gfx::Rect, kTestRectPropertyKey, nullptr);
49 DEFINE_OWNED_WINDOW_PROPERTY_KEY(gfx::Size, kTestSizePropertyKey, nullptr); 49 DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(gfx::Size, kTestSizePropertyKey, nullptr);
50 DEFINE_OWNED_WINDOW_PROPERTY_KEY(std::string, kTestStringPropertyKey, nullptr); 50 DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(
51 DEFINE_OWNED_WINDOW_PROPERTY_KEY(base::string16, kTestString16PropertyKey, 51 std::string, kTestStringPropertyKey, nullptr);
52 DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(base::string16, kTestString16PropertyKey,
52 nullptr); 53 nullptr);
53 54
54 const char kTestPropertyServerKey0[] = "test-property-server0"; 55 const char kTestPropertyServerKey0[] = "test-property-server0";
55 const char kTestPropertyServerKey1[] = "test-property-server1"; 56 const char kTestPropertyServerKey1[] = "test-property-server1";
56 const char kTestPropertyServerKey2[] = "test-property-server2"; 57 const char kTestPropertyServerKey2[] = "test-property-server2";
57 const char kTestPropertyServerKey3[] = "test-property-server3"; 58 const char kTestPropertyServerKey3[] = "test-property-server3";
58 const char kTestPropertyServerKey4[] = "test-property-server4"; 59 const char kTestPropertyServerKey4[] = "test-property-server4";
59 const char kTestPropertyServerKey5[] = "test-property-server5"; 60 const char kTestPropertyServerKey5[] = "test-property-server5";
60 const char kTestPropertyServerKey6[] = "test-property-server6"; 61 const char kTestPropertyServerKey6[] = "test-property-server6";
61 const char kTestPropertyServerKey7[] = "test-property-server7"; 62 const char kTestPropertyServerKey7[] = "test-property-server7";
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 319
319 base::string16 value_2 = base::ASCIIToUTF16("another test value"); 320 base::string16 value_2 = base::ASCIIToUTF16("another test value");
320 std::vector<uint8_t> transport_value = 321 std::vector<uint8_t> transport_value =
321 mojo::ConvertTo<std::vector<uint8_t>>(value_2); 322 mojo::ConvertTo<std::vector<uint8_t>>(value_2);
322 property_converter.SetPropertyFromTransportValue( 323 property_converter.SetPropertyFromTransportValue(
323 window.get(), kTestString16PropertyServerKey, &transport_value); 324 window.get(), kTestString16PropertyServerKey, &transport_value);
324 EXPECT_EQ(value_2, *window->GetProperty(kTestString16PropertyKey)); 325 EXPECT_EQ(value_2, *window->GetProperty(kTestString16PropertyKey));
325 } 326 }
326 327
327 } // namespace aura 328 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698