| 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 "components/translate/ios/browser/language_detection_controller.h" | 5 #import "components/translate/ios/browser/language_detection_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/bind_objc_block.h" | 7 #include "base/mac/bind_objc_block.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "components/prefs/pref_registry_simple.h" | 9 #include "components/prefs/pref_registry_simple.h" |
| 10 #include "components/prefs/testing_pref_service.h" | 10 #include "components/prefs/testing_pref_service.h" |
| 11 #include "components/translate/core/common/translate_pref_names.h" | 11 #include "components/translate/core/common/translate_pref_names.h" |
| 12 #import "components/translate/ios/browser/js_language_detection_manager.h" | 12 #import "components/translate/ios/browser/js_language_detection_manager.h" |
| 13 #include "ios/web/public/test/test_web_state.h" | 13 #import "ios/web/public/test/fakes/test_web_state.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
| 16 | 16 |
| 17 @interface MockJsLanguageDetectionManager : JsLanguageDetectionManager | 17 @interface MockJsLanguageDetectionManager : JsLanguageDetectionManager |
| 18 @end | 18 @end |
| 19 | 19 |
| 20 @implementation MockJsLanguageDetectionManager | 20 @implementation MockJsLanguageDetectionManager |
| 21 - (void)retrieveBufferedTextContent: | 21 - (void)retrieveBufferedTextContent: |
| 22 (const language_detection::BufferedTextCallback&)callback { | 22 (const language_detection::BufferedTextCallback&)callback { |
| 23 callback.Run(base::UTF8ToUTF16("Some content")); | 23 callback.Run(base::UTF8ToUTF16("Some content")); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 command.SetBoolean("translationAllowed", true); | 69 command.SetBoolean("translationAllowed", true); |
| 70 command.SetInteger("captureTextTime", 10); | 70 command.SetInteger("captureTextTime", 10); |
| 71 command.SetString("htmlLang", kRootLanguage); | 71 command.SetString("htmlLang", kRootLanguage); |
| 72 command.SetString("httpContentLanguage", kContentLanguage); | 72 command.SetString("httpContentLanguage", kContentLanguage); |
| 73 controller()->OnTextCaptured(command, GURL("http://google.com"), false); | 73 controller()->OnTextCaptured(command, GURL("http://google.com"), false); |
| 74 | 74 |
| 75 EXPECT_TRUE(block_was_called); | 75 EXPECT_TRUE(block_was_called); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace translate | 78 } // namespace translate |
| OLD | NEW |