| 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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/prefs/pref_registry_simple.h" | 10 #include "components/prefs/pref_registry_simple.h" |
| 11 #include "components/prefs/testing_pref_service.h" | 11 #include "components/prefs/testing_pref_service.h" |
| 12 #include "components/translate/core/common/translate_pref_names.h" | 12 #include "components/translate/core/browser/translate_pref_names.h" |
| 13 #import "components/translate/ios/browser/js_language_detection_manager.h" | 13 #import "components/translate/ios/browser/js_language_detection_manager.h" |
| 14 #import "ios/web/public/test/fakes/test_web_state.h" | 14 #import "ios/web/public/test/fakes/test_web_state.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "testing/platform_test.h" | 16 #include "testing/platform_test.h" |
| 17 | 17 |
| 18 #if !defined(__has_feature) || !__has_feature(objc_arc) | 18 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 19 #error "This file requires ARC support." | 19 #error "This file requires ARC support." |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 @interface MockJsLanguageDetectionManager : JsLanguageDetectionManager | 22 @interface MockJsLanguageDetectionManager : JsLanguageDetectionManager |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 command.SetBoolean("translationAllowed", true); | 74 command.SetBoolean("translationAllowed", true); |
| 75 command.SetInteger("captureTextTime", 10); | 75 command.SetInteger("captureTextTime", 10); |
| 76 command.SetString("htmlLang", kRootLanguage); | 76 command.SetString("htmlLang", kRootLanguage); |
| 77 command.SetString("httpContentLanguage", kContentLanguage); | 77 command.SetString("httpContentLanguage", kContentLanguage); |
| 78 controller()->OnTextCaptured(command, GURL("http://google.com"), false); | 78 controller()->OnTextCaptured(command, GURL("http://google.com"), false); |
| 79 | 79 |
| 80 EXPECT_TRUE(block_was_called); | 80 EXPECT_TRUE(block_was_called); |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace translate | 83 } // namespace translate |
| OLD | NEW |