| 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 #import "ios/web/web_state/ui/web_view_js_utils.h" | 5 #import "ios/web/web_state/ui/web_view_js_utils.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
| 9 #include "base/test/ios/wait_util.h" | 9 #include "base/test/ios/wait_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "ios/web/public/test/test_browser_state.h" | 11 #include "ios/web/public/test/test_browser_state.h" |
| 12 #import "ios/web/public/test/test_web_client.h" | 12 #import "ios/web/public/test/test_web_client.h" |
| 13 #import "ios/web/public/web_view_creation_util.h" | 13 #import "ios/web/public/web_view_creation_util.h" |
| 14 #import "ios/web/web_state/web_view_internal_creation_util.h" | 14 #import "ios/web/web_state/web_view_internal_creation_util.h" |
| 15 #import "ios/web/test/web_test.h" | 15 #include "ios/web/public/test/web_test.h" |
| 16 #include "testing/gtest_mac.h" | 16 #include "testing/gtest_mac.h" |
| 17 #include "testing/platform_test.h" | 17 #include "testing/platform_test.h" |
| 18 | 18 |
| 19 namespace web { | 19 namespace web { |
| 20 | 20 |
| 21 // Test fixture for web::EvaluateJavaScript testing. | 21 // Test fixture for web::EvaluateJavaScript testing. |
| 22 class WebViewJsUtilsTest : public web::WebTest { | 22 class WebViewJsUtilsTest : public web::WebTest { |
| 23 protected: | 23 protected: |
| 24 void SetUp() override { | 24 void SetUp() override { |
| 25 web::WebTest::SetUp(); | 25 web::WebTest::SetUp(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 EXPECT_NSEQ(@"true", EvaluateJavaScript(@"true")); | 123 EXPECT_NSEQ(@"true", EvaluateJavaScript(@"true")); |
| 124 EXPECT_NSEQ(@"false", EvaluateJavaScript(@"false")); | 124 EXPECT_NSEQ(@"false", EvaluateJavaScript(@"false")); |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Tests that a script with null result correctly evaluates to empty string. | 127 // Tests that a script with null result correctly evaluates to empty string. |
| 128 TEST_F(WebViewJsUtilsTest, NullEvaluation) { | 128 TEST_F(WebViewJsUtilsTest, NullEvaluation) { |
| 129 EXPECT_NSEQ(@"", EvaluateJavaScript(@"null")); | 129 EXPECT_NSEQ(@"", EvaluateJavaScript(@"null")); |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace web | 132 } // namespace web |
| OLD | NEW |