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" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
| 13 namespace translate { |
13 namespace { | 14 namespace { |
14 | 15 |
15 const std::string kHtmlMimeType = "text/html"; | 16 const std::string kHtmlMimeType = "text/html"; |
16 | 17 |
17 class MockTranslateDriver : public TranslateDriver { | 18 class MockTranslateDriver : public TranslateDriver { |
18 public: | 19 public: |
19 MockTranslateDriver() | 20 MockTranslateDriver() |
20 : on_is_page_translated_changed_called_(false), | 21 : on_is_page_translated_changed_called_(false), |
21 on_translate_enabled_changed_called_(false), | 22 on_translate_enabled_changed_called_(false), |
22 language_state_(this) { | 23 language_state_(this) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 137 |
137 // Translate. | 138 // Translate. |
138 language_state.SetCurrentLanguage("en"); | 139 language_state.SetCurrentLanguage("en"); |
139 EXPECT_TRUE(language_state.IsPageTranslated()); | 140 EXPECT_TRUE(language_state.IsPageTranslated()); |
140 EXPECT_TRUE(driver->on_is_page_translated_changed_called()); | 141 EXPECT_TRUE(driver->on_is_page_translated_changed_called()); |
141 | 142 |
142 // Translate feature must be enabled after an actual translation. | 143 // Translate feature must be enabled after an actual translation. |
143 EXPECT_TRUE(language_state.translate_enabled()); | 144 EXPECT_TRUE(language_state.translate_enabled()); |
144 EXPECT_TRUE(driver->on_translate_enabled_changed_called()); | 145 EXPECT_TRUE(driver->on_translate_enabled_changed_called()); |
145 } | 146 } |
| 147 |
| 148 } // namespace translate |
OLD | NEW |