| OLD | NEW |
| 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 #import "chrome/browser/ui/cocoa/applescript/apple_event_util.h" | 5 #import "chrome/browser/ui/cocoa/applescript/apple_event_util.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 12 #include "testing/gtest_mac.h" | 12 #include "testing/gtest_mac.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class AppleEventUtilTest : public CocoaTest { }; | 16 class AppleEventUtilTest : public CocoaTest { }; |
| 17 | 17 |
| 18 struct TestCase { | 18 struct TestCase { |
| 19 const char* json_input; | 19 const char* json_input; |
| 20 const char* expected_aedesc_dump; | 20 const char* expected_aedesc_dump; |
| 21 DescType expected_aedesc_type; | 21 DescType expected_aedesc_type; |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 TEST_F(AppleEventUtilTest, ValueToAppleEventDescriptor) { | 24 TEST_F(AppleEventUtilTest, DISABLED_ValueToAppleEventDescriptor) { |
| 25 const struct TestCase cases[] = { | 25 const struct TestCase cases[] = { |
| 26 { "null", "'msng'", typeType }, | 26 { "null", "'msng'", typeType }, |
| 27 { "-1000", "-1000", typeSInt32 }, | 27 { "-1000", "-1000", typeSInt32 }, |
| 28 { "0", "0", typeSInt32 }, | 28 { "0", "0", typeSInt32 }, |
| 29 { "1000", "1000", typeSInt32 }, | 29 { "1000", "1000", typeSInt32 }, |
| 30 { "-1e100", "-1e+100", typeIEEE64BitFloatingPoint }, | 30 { "-1e100", "-1e+100", typeIEEE64BitFloatingPoint }, |
| 31 { "0.0", "0", typeIEEE64BitFloatingPoint }, | 31 { "0.0", "0", typeIEEE64BitFloatingPoint }, |
| 32 { "1e100", "1e+100", typeIEEE64BitFloatingPoint }, | 32 { "1e100", "1e+100", typeIEEE64BitFloatingPoint }, |
| 33 { "\"\"", "'utxt'(\"\")", typeUnicodeText }, |
| 33 { "\"string\"", "'utxt'(\"string\")", typeUnicodeText }, | 34 { "\"string\"", "'utxt'(\"string\")", typeUnicodeText }, |
| 34 { "{}", "{ 'usrf':[ ] }", typeAERecord }, | 35 { "{}", "{ 'usrf':[ ] }", typeAERecord }, |
| 35 { "[]", "[ ]", typeAEList }, | 36 { "[]", "[ ]", typeAEList }, |
| 36 { "{\"Image\": {" | 37 { "{\"Image\": {" |
| 37 "\"Width\": 800," | 38 "\"Width\": 800," |
| 38 "\"Height\": 600," | 39 "\"Height\": 600," |
| 39 "\"Title\": \"View from 15th Floor\"," | 40 "\"Title\": \"View from 15th Floor\"," |
| 40 "\"Thumbnail\": {" | 41 "\"Thumbnail\": {" |
| 41 "\"Url\": \"http://www.example.com/image/481989943\"," | 42 "\"Url\": \"http://www.example.com/image/481989943\"," |
| 42 "\"Height\": 125," | 43 "\"Height\": 125," |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 base::FundamentalValue value(b); | 112 base::FundamentalValue value(b); |
| 112 NSAppleEventDescriptor* descriptor = | 113 NSAppleEventDescriptor* descriptor = |
| 113 chrome::mac::ValueToAppleEventDescriptor(&value); | 114 chrome::mac::ValueToAppleEventDescriptor(&value); |
| 114 | 115 |
| 115 EXPECT_EQ(typeBoolean, [descriptor descriptorType]); | 116 EXPECT_EQ(typeBoolean, [descriptor descriptorType]); |
| 116 EXPECT_EQ(b, [descriptor booleanValue]); | 117 EXPECT_EQ(b, [descriptor booleanValue]); |
| 117 } | 118 } |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace | 121 } // namespace |
| OLD | NEW |