| 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 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 params.media_flags = 0; | 395 params.media_flags = 0; |
| 396 params.spellcheck_enabled = false; | 396 params.spellcheck_enabled = false; |
| 397 params.is_editable = false; | 397 params.is_editable = false; |
| 398 params.page_url = web_contents->GetController().GetActiveEntry()->GetURL(); | 398 params.page_url = web_contents->GetController().GetActiveEntry()->GetURL(); |
| 399 #if defined(OS_MACOSX) | 399 #if defined(OS_MACOSX) |
| 400 params.writing_direction_default = 0; | 400 params.writing_direction_default = 0; |
| 401 params.writing_direction_left_to_right = 0; | 401 params.writing_direction_left_to_right = 0; |
| 402 params.writing_direction_right_to_left = 0; | 402 params.writing_direction_right_to_left = 0; |
| 403 #endif // OS_MACOSX | 403 #endif // OS_MACOSX |
| 404 params.edit_flags = blink::WebContextMenuData::CanTranslate; | 404 params.edit_flags = blink::WebContextMenuData::CanTranslate; |
| 405 return new TestRenderViewContextMenu(web_contents, params); | 405 return new TestRenderViewContextMenu(web_contents->GetMainFrame(), params); |
| 406 } | 406 } |
| 407 | 407 |
| 408 bool IsItemPresent(int id) { | 408 bool IsItemPresent(int id) { |
| 409 return menu_model_.GetIndexOfCommandId(id) != -1; | 409 return menu_model_.GetIndexOfCommandId(id) != -1; |
| 410 } | 410 } |
| 411 | 411 |
| 412 virtual void PlatformInit() OVERRIDE { } | 412 virtual void PlatformInit() OVERRIDE { } |
| 413 virtual void PlatformCancel() OVERRIDE { } | 413 virtual void PlatformCancel() OVERRIDE { } |
| 414 virtual bool GetAcceleratorForCommandId( | 414 virtual bool GetAcceleratorForCommandId( |
| 415 int command_id, | 415 int command_id, |
| 416 ui::Accelerator* accelerator) OVERRIDE { return false; } | 416 ui::Accelerator* accelerator) OVERRIDE { return false; } |
| 417 | 417 |
| 418 private: | 418 private: |
| 419 TestRenderViewContextMenu(content::WebContents* web_contents, | 419 TestRenderViewContextMenu(content::RenderFrameHost* render_frame_host, |
| 420 const content::ContextMenuParams& params) | 420 const content::ContextMenuParams& params) |
| 421 : RenderViewContextMenu(web_contents, params) { | 421 : RenderViewContextMenu(render_frame_host, params) { |
| 422 } | 422 } |
| 423 | 423 |
| 424 DISALLOW_COPY_AND_ASSIGN(TestRenderViewContextMenu); | 424 DISALLOW_COPY_AND_ASSIGN(TestRenderViewContextMenu); |
| 425 }; | 425 }; |
| 426 | 426 |
| 427 } // namespace | 427 } // namespace |
| 428 | 428 |
| 429 TEST_F(TranslateManagerBrowserTest, NormalTranslate) { | 429 TEST_F(TranslateManagerBrowserTest, NormalTranslate) { |
| 430 SimulateNavigation(GURL("http://www.google.fr"), "fr", true); | 430 SimulateNavigation(GURL("http://www.google.fr"), "fr", true); |
| 431 | 431 |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 content::WebContents* current_web_contents = | 1625 content::WebContents* current_web_contents = |
| 1626 browser()->tab_strip_model()->GetActiveWebContents(); | 1626 browser()->tab_strip_model()->GetActiveWebContents(); |
| 1627 content::Source<content::WebContents> source(current_web_contents); | 1627 content::Source<content::WebContents> source(current_web_contents); |
| 1628 | 1628 |
| 1629 ui_test_utils::WindowedNotificationObserverWithDetails< | 1629 ui_test_utils::WindowedNotificationObserverWithDetails< |
| 1630 LanguageDetectionDetails> | 1630 LanguageDetectionDetails> |
| 1631 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, | 1631 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, |
| 1632 source); | 1632 source); |
| 1633 fr_language_detected_signal.Wait(); | 1633 fr_language_detected_signal.Wait(); |
| 1634 } | 1634 } |
| OLD | NEW |