| 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 "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); | 412 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); |
| 413 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKLOCATION)); | 413 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKLOCATION)); |
| 414 // With only one profile exists, we don't add any items to the context menu | 414 // With only one profile exists, we don't add any items to the context menu |
| 415 // for opening links in other profiles. | 415 // for opening links in other profiles. |
| 416 ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKINPROFILE)); | 416 ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKINPROFILE)); |
| 417 ASSERT_FALSE(menu->IsItemInRangePresent(IDC_OPEN_LINK_IN_PROFILE_FIRST, | 417 ASSERT_FALSE(menu->IsItemInRangePresent(IDC_OPEN_LINK_IN_PROFILE_FIRST, |
| 418 IDC_OPEN_LINK_IN_PROFILE_LAST)); | 418 IDC_OPEN_LINK_IN_PROFILE_LAST)); |
| 419 } | 419 } |
| 420 | 420 |
| 421 // Create one additional profile, but do not yet open windows in it. | 421 // Create one additional profile, but do not yet open windows in it. |
| 422 CreateSecondaryProfile(1); | 422 Profile* profile = CreateSecondaryProfile(1); |
| 423 | 423 |
| 424 { | 424 { |
| 425 std::unique_ptr<TestRenderViewContextMenu> menu( | 425 std::unique_ptr<TestRenderViewContextMenu> menu( |
| 426 CreateContextMenuMediaTypeNone(GURL("http://www.google.com/"), | 426 CreateContextMenuMediaTypeNone(GURL("http://www.google.com/"), |
| 427 GURL("http://www.google.com/"))); | 427 GURL("http://www.google.com/"))); |
| 428 | 428 |
| 429 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB)); | 429 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB)); |
| 430 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); | 430 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); |
| 431 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKLOCATION)); | 431 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKLOCATION)); |
| 432 // With two profiles (the current and another profile), no submenu is | 432 // With the second profile not open, no entry is created. |
| 433 // created. Instead, a single item is added to the main context menu. | 433 ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKINPROFILE)); |
| 434 ASSERT_FALSE(menu->IsItemPresent(IDC_OPEN_LINK_IN_PROFILE_FIRST)); |
| 435 } |
| 436 |
| 437 profiles::FindOrCreateNewWindowForProfile( |
| 438 profile, chrome::startup::IS_NOT_PROCESS_STARTUP, |
| 439 chrome::startup::IS_NOT_FIRST_RUN, false); |
| 440 |
| 441 { |
| 442 std::unique_ptr<TestRenderViewContextMenu> menu( |
| 443 CreateContextMenuMediaTypeNone(GURL("http://www.google.com/"), |
| 444 GURL("http://www.google.com/"))); |
| 445 |
| 446 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB)); |
| 447 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); |
| 448 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKLOCATION)); |
| 449 // With the second profile open, an inline menu entry is created. |
| 434 ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKINPROFILE)); | 450 ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKINPROFILE)); |
| 435 ASSERT_TRUE(menu->IsItemPresent(IDC_OPEN_LINK_IN_PROFILE_FIRST)); | 451 ASSERT_TRUE(menu->IsItemPresent(IDC_OPEN_LINK_IN_PROFILE_FIRST)); |
| 436 } | 452 } |
| 437 | 453 |
| 438 CreateSecondaryProfile(2); | 454 CreateSecondaryProfile(2); |
| 439 | 455 |
| 440 { | 456 { |
| 441 std::unique_ptr<TestRenderViewContextMenu> menu( | 457 std::unique_ptr<TestRenderViewContextMenu> menu( |
| 442 CreateContextMenuMediaTypeNone(GURL("http://www.google.com/"), | 458 CreateContextMenuMediaTypeNone(GURL("http://www.google.com/"), |
| 443 GURL("http://www.google.com/"))); | 459 GURL("http://www.google.com/"))); |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { | 841 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { |
| 826 static const char kValidImage[] = "/load_image/image.png"; | 842 static const char kValidImage[] = "/load_image/image.png"; |
| 827 SetupAndLoadImagePage(kValidImage); | 843 SetupAndLoadImagePage(kValidImage); |
| 828 AddLoadImageInterceptor(kValidImage); | 844 AddLoadImageInterceptor(kValidImage); |
| 829 AttemptLoadImage(); | 845 AttemptLoadImage(); |
| 830 interceptor_->WaitForRequests(1); | 846 interceptor_->WaitForRequests(1); |
| 831 EXPECT_EQ(1, interceptor_->num_requests()); | 847 EXPECT_EQ(1, interceptor_->num_requests()); |
| 832 } | 848 } |
| 833 | 849 |
| 834 } // namespace | 850 } // namespace |
| OLD | NEW |