| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <ostream> | 6 #include <ostream> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "mojo/public/cpp/environment/environment.h" | 9 #include "mojo/public/cpp/environment/environment.h" |
| 10 #include "mojo/public/cpp/system/macros.h" | 10 #include "mojo/public/cpp/system/macros.h" |
| 11 #include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h" | 11 #include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 | 15 |
| 16 template <> | 16 template <> |
| 17 class TypeConverter<sample::BarPtr, int32_t> { | 17 struct TypeConverter<int32_t, sample::BarPtr> { |
| 18 public: | 18 static int32_t Convert(const sample::BarPtr& bar) { |
| 19 static int32_t ConvertTo(const sample::BarPtr& bar) { | |
| 20 return static_cast<int32_t>(bar->alpha) << 16 | | 19 return static_cast<int32_t>(bar->alpha) << 16 | |
| 21 static_cast<int32_t>(bar->beta) << 8 | | 20 static_cast<int32_t>(bar->beta) << 8 | |
| 22 static_cast<int32_t>(bar->gamma); | 21 static_cast<int32_t>(bar->gamma); |
| 23 } | 22 } |
| 24 }; | 23 }; |
| 25 | 24 |
| 26 } // namespace mojo | 25 } // namespace mojo |
| 27 | 26 |
| 28 namespace sample { | 27 namespace sample { |
| 29 namespace { | 28 namespace { |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 ASSERT_FALSE(defaults->a22.is_null()); | 372 ASSERT_FALSE(defaults->a22.is_null()); |
| 374 EXPECT_EQ(imported::SHAPE_RECTANGLE, defaults->a22->shape); | 373 EXPECT_EQ(imported::SHAPE_RECTANGLE, defaults->a22->shape); |
| 375 EXPECT_EQ(imported::COLOR_BLACK, defaults->a22->color); | 374 EXPECT_EQ(imported::COLOR_BLACK, defaults->a22->color); |
| 376 EXPECT_EQ(0xFFFFFFFFFFFFFFFFULL, defaults->a23); | 375 EXPECT_EQ(0xFFFFFFFFFFFFFFFFULL, defaults->a23); |
| 377 EXPECT_EQ(0x123456789, defaults->a24); | 376 EXPECT_EQ(0x123456789, defaults->a24); |
| 378 EXPECT_EQ(-0x123456789, defaults->a25); | 377 EXPECT_EQ(-0x123456789, defaults->a25); |
| 379 } | 378 } |
| 380 | 379 |
| 381 } // namespace | 380 } // namespace |
| 382 } // namespace sample | 381 } // namespace sample |
| OLD | NEW |