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 "components/translate/core/browser/language_state.h" | 5 #include "components/translate/core/browser/language_state.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "components/translate/core/browser/language_state.h" | 8 #include "components/translate/core/browser/language_state.h" |
9 #include "components/translate/core/browser/translate_driver.h" | 9 #include "components/translate/core/browser/translate_driver.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 virtual void OnTranslateEnabledChanged() OVERRIDE { | 36 virtual void OnTranslateEnabledChanged() OVERRIDE { |
37 on_translate_enabled_changed_called_ = true; | 37 on_translate_enabled_changed_called_ = true; |
38 } | 38 } |
39 | 39 |
40 virtual bool IsLinkNavigation() OVERRIDE { | 40 virtual bool IsLinkNavigation() OVERRIDE { |
41 return false; | 41 return false; |
42 } | 42 } |
43 | 43 |
44 virtual LanguageState& GetLanguageState() OVERRIDE { | |
45 return language_state_; | |
46 } | |
47 | |
48 virtual void TranslatePage(const std::string& translate_script, | 44 virtual void TranslatePage(const std::string& translate_script, |
49 const std::string& source_lang, | 45 const std::string& source_lang, |
50 const std::string& target_lang) OVERRIDE {} | 46 const std::string& target_lang) OVERRIDE {} |
51 | 47 |
52 virtual void RevertTranslation() OVERRIDE {} | 48 virtual void RevertTranslation() OVERRIDE {} |
53 | 49 |
54 virtual bool IsOffTheRecord() OVERRIDE { return false; } | 50 virtual bool IsOffTheRecord() OVERRIDE { return false; } |
55 | 51 |
56 virtual const std::string& GetContentsMimeType() OVERRIDE { | 52 virtual const std::string& GetContentsMimeType() OVERRIDE { |
57 return kHtmlMimeType; | 53 return kHtmlMimeType; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 135 |
140 // Translate. | 136 // Translate. |
141 language_state.SetCurrentLanguage("en"); | 137 language_state.SetCurrentLanguage("en"); |
142 EXPECT_TRUE(language_state.IsPageTranslated()); | 138 EXPECT_TRUE(language_state.IsPageTranslated()); |
143 EXPECT_TRUE(driver->on_is_page_translated_changed_called()); | 139 EXPECT_TRUE(driver->on_is_page_translated_changed_called()); |
144 | 140 |
145 // Translate feature must be enabled after an actual translation. | 141 // Translate feature must be enabled after an actual translation. |
146 EXPECT_TRUE(language_state.translate_enabled()); | 142 EXPECT_TRUE(language_state.translate_enabled()); |
147 EXPECT_TRUE(driver->on_translate_enabled_changed_called()); | 143 EXPECT_TRUE(driver->on_translate_enabled_changed_called()); |
148 } | 144 } |
OLD | NEW |