| 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 <limits> | 5 #include <limits> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 builder.set_ui32(kExpectedUInt32Value); | 146 builder.set_ui32(kExpectedUInt32Value); |
| 147 builder.set_ui16(kExpectedUInt16Value); | 147 builder.set_ui16(kExpectedUInt16Value); |
| 148 builder.set_ui8(kExpectedUInt8Value); | 148 builder.set_ui8(kExpectedUInt8Value); |
| 149 builder.set_float_val(kExpectedFloatVal); | 149 builder.set_float_val(kExpectedFloatVal); |
| 150 builder.set_float_inf(kExpectedFloatInf); | 150 builder.set_float_inf(kExpectedFloatInf); |
| 151 builder.set_float_nan(kExpectedFloatNan); | 151 builder.set_float_nan(kExpectedFloatNan); |
| 152 builder.set_double_val(kExpectedDoubleVal); | 152 builder.set_double_val(kExpectedDoubleVal); |
| 153 builder.set_double_inf(kExpectedDoubleInf); | 153 builder.set_double_inf(kExpectedDoubleInf); |
| 154 builder.set_double_nan(kExpectedDoubleNan); | 154 builder.set_double_nan(kExpectedDoubleNan); |
| 155 builder.set_name("coming"); | 155 builder.set_name("coming"); |
| 156 mojo::Array<mojo::String>::Builder string_array(3); |
| 157 string_array[0] = "one"; |
| 158 string_array[1] = "two"; |
| 159 string_array[2] = "three"; |
| 160 builder.set_string_array(string_array.Finish()); |
| 156 client_->Echo(builder.Finish()); | 161 client_->Echo(builder.Finish()); |
| 157 } | 162 } |
| 158 | 163 |
| 159 virtual ~EchoBrowserTargetImpl() {} | 164 virtual ~EchoBrowserTargetImpl() {} |
| 160 | 165 |
| 161 // mojo::BrowserTarget overrides: | 166 // mojo::BrowserTarget overrides: |
| 162 // Check the response, and quit the RunLoop after N calls. | 167 // Check the response, and quit the RunLoop after N calls. |
| 163 virtual void EchoResponse(const mojo::EchoArgs& arg1, | 168 virtual void EchoResponse(const mojo::EchoArgs& arg1, |
| 164 const mojo::EchoArgs& arg2) OVERRIDE { | 169 const mojo::EchoArgs& arg2) OVERRIDE { |
| 165 EXPECT_EQ(kExpectedInt64Value, arg1.si64()); | 170 EXPECT_EQ(kExpectedInt64Value, arg1.si64()); |
| 166 EXPECT_EQ(kExpectedInt32Value, arg1.si32()); | 171 EXPECT_EQ(kExpectedInt32Value, arg1.si32()); |
| 167 EXPECT_EQ(kExpectedInt16Value, arg1.si16()); | 172 EXPECT_EQ(kExpectedInt16Value, arg1.si16()); |
| 168 EXPECT_EQ(kExpectedInt8Value, arg1.si8()); | 173 EXPECT_EQ(kExpectedInt8Value, arg1.si8()); |
| 169 EXPECT_EQ(kExpectedUInt64Value, arg1.ui64()); | 174 EXPECT_EQ(kExpectedUInt64Value, arg1.ui64()); |
| 170 EXPECT_EQ(kExpectedUInt32Value, arg1.ui32()); | 175 EXPECT_EQ(kExpectedUInt32Value, arg1.ui32()); |
| 171 EXPECT_EQ(kExpectedUInt16Value, arg1.ui16()); | 176 EXPECT_EQ(kExpectedUInt16Value, arg1.ui16()); |
| 172 EXPECT_EQ(kExpectedUInt8Value, arg1.ui8()); | 177 EXPECT_EQ(kExpectedUInt8Value, arg1.ui8()); |
| 173 EXPECT_EQ(kExpectedFloatVal, arg1.float_val()); | 178 EXPECT_EQ(kExpectedFloatVal, arg1.float_val()); |
| 174 EXPECT_EQ(kExpectedFloatInf, arg1.float_inf()); | 179 EXPECT_EQ(kExpectedFloatInf, arg1.float_inf()); |
| 175 EXPECT_NAN(arg1.float_nan()); | 180 EXPECT_NAN(arg1.float_nan()); |
| 176 EXPECT_EQ(kExpectedDoubleVal, arg1.double_val()); | 181 EXPECT_EQ(kExpectedDoubleVal, arg1.double_val()); |
| 177 EXPECT_EQ(kExpectedDoubleInf, arg1.double_inf()); | 182 EXPECT_EQ(kExpectedDoubleInf, arg1.double_inf()); |
| 178 EXPECT_NAN(arg1.double_nan()); | 183 EXPECT_NAN(arg1.double_nan()); |
| 179 EXPECT_EQ(std::string("coming"), arg1.name().To<std::string>()); | 184 EXPECT_EQ(std::string("coming"), arg1.name().To<std::string>()); |
| 185 EXPECT_EQ(std::string("one"), arg1.string_array()[0].To<std::string>()); |
| 186 EXPECT_EQ(std::string("two"), arg1.string_array()[1].To<std::string>()); |
| 187 EXPECT_EQ(std::string("three"), arg1.string_array()[2].To<std::string>()); |
| 180 | 188 |
| 181 EXPECT_EQ(-1, arg2.si64()); | 189 EXPECT_EQ(-1, arg2.si64()); |
| 182 EXPECT_EQ(-1, arg2.si32()); | 190 EXPECT_EQ(-1, arg2.si32()); |
| 183 EXPECT_EQ(-1, arg2.si16()); | 191 EXPECT_EQ(-1, arg2.si16()); |
| 184 EXPECT_EQ(-1, arg2.si8()); | 192 EXPECT_EQ(-1, arg2.si8()); |
| 185 EXPECT_EQ(std::string("going"), arg2.name().To<std::string>()); | 193 EXPECT_EQ(std::string("going"), arg2.name().To<std::string>()); |
| 186 | 194 |
| 187 message_count += 1; | 195 message_count += 1; |
| 188 if (message_count == kExpectedMessageCount) | 196 if (message_count == kExpectedMessageCount) |
| 189 run_loop_->Quit(); | 197 run_loop_->Quit(); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 factory()->set_run_loop(&run_loop); | 371 factory()->set_run_loop(&run_loop); |
| 364 GURL test_url(test_server()->GetURL("files/web_ui_mojo.html?echo")); | 372 GURL test_url(test_server()->GetURL("files/web_ui_mojo.html?echo")); |
| 365 NavigateToURL(shell(), test_url); | 373 NavigateToURL(shell(), test_url); |
| 366 // RunLoop is quit when response received from page. | 374 // RunLoop is quit when response received from page. |
| 367 run_loop.Run(); | 375 run_loop.Run(); |
| 368 EXPECT_EQ(kExpectedMessageCount, message_count); | 376 EXPECT_EQ(kExpectedMessageCount, message_count); |
| 369 } | 377 } |
| 370 | 378 |
| 371 } // namespace | 379 } // namespace |
| 372 } // namespace content | 380 } // namespace content |
| OLD | NEW |