| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 5 |
| 6 #include <algorithm> | 6 #include <algorithm> |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 DCHECK_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, type); | 163 DCHECK_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, type); |
| 164 removed_infobars_.insert( | 164 removed_infobars_.insert( |
| 165 content::Details<InfoBarRemovedDetails>(details)->first); | 165 content::Details<InfoBarRemovedDetails>(details)->first); |
| 166 } | 166 } |
| 167 | 167 |
| 168 protected: | 168 protected: |
| 169 virtual void SetUp() { | 169 virtual void SetUp() { |
| 170 WebKit::initialize(&webkit_platform_support_); | 170 WebKit::initialize(&webkit_platform_support_); |
| 171 // Access the TranslateManager singleton so it is created before we call | 171 // Access the TranslateManager singleton so it is created before we call |
| 172 // TabContentsWrapperTestHarness::SetUp() to match what's done in Chrome, | 172 // TabContentsWrapperTestHarness::SetUp() to match what's done in Chrome, |
| 173 // where the TranslateManager is created before the TabContents. This | 173 // where the TranslateManager is created before the WebContents. This |
| 174 // matters as they both register for similar events and we want the | 174 // matters as they both register for similar events and we want the |
| 175 // notifications to happen in the same sequence (TranslateManager first, | 175 // notifications to happen in the same sequence (TranslateManager first, |
| 176 // TabContents second). Also clears the translate script so it is fetched | 176 // WebContents second). Also clears the translate script so it is fetched |
| 177 // everytime and sets the expiration delay to a large value by default (in | 177 // everytime and sets the expiration delay to a large value by default (in |
| 178 // case it was zeroed in a previous test). | 178 // case it was zeroed in a previous test). |
| 179 TranslateManager::GetInstance()->ClearTranslateScript(); | 179 TranslateManager::GetInstance()->ClearTranslateScript(); |
| 180 TranslateManager::GetInstance()-> | 180 TranslateManager::GetInstance()-> |
| 181 set_translate_script_expiration_delay(60 * 60 * 1000); | 181 set_translate_script_expiration_delay(60 * 60 * 1000); |
| 182 | 182 |
| 183 TabContentsWrapperTestHarness::SetUp(); | 183 TabContentsWrapperTestHarness::SetUp(); |
| 184 | 184 |
| 185 notification_registrar_.Add(this, | 185 notification_registrar_.Add(this, |
| 186 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 186 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
| (...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 NULL); | 1459 NULL); |
| 1460 // Now simulate the URL fetch. | 1460 // Now simulate the URL fetch. |
| 1461 SimulateTranslateScriptURLFetch(true); | 1461 SimulateTranslateScriptURLFetch(true); |
| 1462 // Now the message should have been sent. | 1462 // Now the message should have been sent. |
| 1463 int page_id = 0; | 1463 int page_id = 0; |
| 1464 std::string original_lang, target_lang; | 1464 std::string original_lang, target_lang; |
| 1465 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); | 1465 EXPECT_TRUE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); |
| 1466 EXPECT_EQ("es", original_lang); | 1466 EXPECT_EQ("es", original_lang); |
| 1467 EXPECT_EQ("en", target_lang); | 1467 EXPECT_EQ("en", target_lang); |
| 1468 } | 1468 } |
| OLD | NEW |