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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 run_loop_->Quit(); | 649 run_loop_->Quit(); |
650 } | 650 } |
651 | 651 |
652 std::string ConstructPolicy(const std::string& relative_path) { | 652 std::string ConstructPolicy(const std::string& relative_path) { |
653 std::string image_data; | 653 std::string image_data; |
654 if (!base::ReadFileToString(test_data_dir_.Append(relative_path), | 654 if (!base::ReadFileToString(test_data_dir_.Append(relative_path), |
655 &image_data)) { | 655 &image_data)) { |
656 ADD_FAILURE(); | 656 ADD_FAILURE(); |
657 } | 657 } |
658 std::string policy; | 658 std::string policy; |
659 base::JSONWriter::Write(policy::test::ConstructExternalDataReference( | 659 base::JSONWriter::Write(*policy::test::ConstructExternalDataReference( |
660 embedded_test_server()->GetURL(std::string("/") + relative_path).spec(), | 660 embedded_test_server() |
661 image_data).get(), | 661 ->GetURL(std::string("/") + relative_path) |
662 &policy); | 662 .spec(), |
| 663 image_data), |
| 664 &policy); |
663 return policy; | 665 return policy; |
664 } | 666 } |
665 | 667 |
666 policy::UserPolicyBuilder user_policy_; | 668 policy::UserPolicyBuilder user_policy_; |
667 FakeSessionManagerClient* fake_session_manager_client_; | 669 FakeSessionManagerClient* fake_session_manager_client_; |
668 | 670 |
669 scoped_ptr<gfx::ImageSkia> policy_image_; | 671 scoped_ptr<gfx::ImageSkia> policy_image_; |
670 | 672 |
671 private: | 673 private: |
672 DISALLOW_COPY_AND_ASSIGN(UserImageManagerPolicyTest); | 674 DISALLOW_COPY_AND_ASSIGN(UserImageManagerPolicyTest); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 | 887 |
886 saved_image = test::ImageLoader(GetUserImagePath(kTestUser1, "jpg")).Load(); | 888 saved_image = test::ImageLoader(GetUserImagePath(kTestUser1, "jpg")).Load(); |
887 ASSERT_TRUE(saved_image); | 889 ASSERT_TRUE(saved_image); |
888 | 890 |
889 // Check image dimensions. Images can't be compared since JPEG is lossy. | 891 // Check image dimensions. Images can't be compared since JPEG is lossy. |
890 EXPECT_EQ(policy_image_->width(), saved_image->width()); | 892 EXPECT_EQ(policy_image_->width(), saved_image->width()); |
891 EXPECT_EQ(policy_image_->height(), saved_image->height()); | 893 EXPECT_EQ(policy_image_->height(), saved_image->height()); |
892 } | 894 } |
893 | 895 |
894 } // namespace chromeos | 896 } // namespace chromeos |
OLD | NEW |