OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/chrome_constants.h" | 5 #include "chrome/common/chrome_constants.h" |
6 #include "chrome/common/render_messages.h" | 6 #include "chrome/common/render_messages.h" |
7 #include "chrome/renderer/translate_helper.h" | 7 #include "chrome/renderer/translate_helper.h" |
8 #include "chrome/test/base/render_view_test.h" | 8 #include "chrome/test/base/render_view_test.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 using testing::AtLeast; | 12 using testing::AtLeast; |
13 using testing::Return; | 13 using testing::Return; |
14 | 14 |
15 class TestTranslateHelper : public TranslateHelper { | 15 class TestTranslateHelper : public TranslateHelper { |
16 public: | 16 public: |
17 explicit TestTranslateHelper(RenderView* render_view) | 17 explicit TestTranslateHelper(content::RenderView* render_view) |
18 : TranslateHelper(render_view, NULL) { | 18 : TranslateHelper(render_view, NULL) { |
19 } | 19 } |
20 | 20 |
21 virtual bool DontDelayTasks() { return true; } | 21 virtual bool DontDelayTasks() { return true; } |
22 | 22 |
23 void TranslatePage(int page_id, | 23 void TranslatePage(int page_id, |
24 const std::string& source_lang, | 24 const std::string& source_lang, |
25 const std::string& target_lang, | 25 const std::string& target_lang, |
26 const std::string& translate_script) { | 26 const std::string& translate_script) { |
27 OnTranslatePage(page_id, translate_script, source_lang, target_lang); | 27 OnTranslatePage(page_id, translate_script, source_lang, target_lang); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 LoadHTML("<html><head><meta http-equiv=\"content-language\" " | 357 LoadHTML("<html><head><meta http-equiv=\"content-language\" " |
358 "content=\" fr , es,en \">" | 358 "content=\" fr , es,en \">" |
359 "</head><body>A random page with random content.</body></html>"); | 359 "</head><body>A random page with random content.</body></html>"); |
360 ProcessPendingMessages(); | 360 ProcessPendingMessages(); |
361 message = render_thread_.sink().GetUniqueMessageMatching( | 361 message = render_thread_.sink().GetUniqueMessageMatching( |
362 ChromeViewHostMsg_TranslateLanguageDetermined::ID); | 362 ChromeViewHostMsg_TranslateLanguageDetermined::ID); |
363 ASSERT_NE(static_cast<IPC::Message*>(NULL), message); | 363 ASSERT_NE(static_cast<IPC::Message*>(NULL), message); |
364 ChromeViewHostMsg_TranslateLanguageDetermined::Read(message, ¶ms); | 364 ChromeViewHostMsg_TranslateLanguageDetermined::Read(message, ¶ms); |
365 EXPECT_EQ("fr", params.a); | 365 EXPECT_EQ("fr", params.a); |
366 } | 366 } |
OLD | NEW |