OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/translate/ios/browser/js_translate_manager.h" | 5 #import "components/translate/ios/browser/js_translate_manager.h" |
6 | 6 |
7 #import "base/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "grit/components_resources.h" | 9 #include "components/grit/components_resources.h" |
10 #import "ios/web/public/test/fakes/crw_test_js_injection_receiver.h" | 10 #import "ios/web/public/test/fakes/crw_test_js_injection_receiver.h" |
11 #import "ios/web/public/test/js_test_util.h" | 11 #import "ios/web/public/test/js_test_util.h" |
12 #import "testing/gtest_mac.h" | 12 #import "testing/gtest_mac.h" |
13 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 | 15 |
16 @interface JsTranslateManager (Testing) | 16 @interface JsTranslateManager (Testing) |
17 - (double)performanceNow; | 17 - (double)performanceNow; |
18 @end | 18 @end |
19 | 19 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 EXPECT_NEAR(timeElapsed, intervalInSeconds * 1000, 100); | 63 EXPECT_NEAR(timeElapsed, intervalInSeconds * 1000, 100); |
64 } | 64 } |
65 | 65 |
66 TEST_F(JsTranslateManagerTest, Inject) { | 66 TEST_F(JsTranslateManagerTest, Inject) { |
67 [manager_ inject]; | 67 [manager_ inject]; |
68 EXPECT_TRUE([manager_ hasBeenInjected]); | 68 EXPECT_TRUE([manager_ hasBeenInjected]); |
69 EXPECT_EQ(nil, [manager_ script]); | 69 EXPECT_EQ(nil, [manager_ script]); |
70 EXPECT_NSEQ(@NO, | 70 EXPECT_NSEQ(@NO, |
71 web::ExecuteJavaScript(manager_, @"cr.googleTranslate.libReady")); | 71 web::ExecuteJavaScript(manager_, @"cr.googleTranslate.libReady")); |
72 } | 72 } |
OLD | NEW |