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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
19 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/threading/thread_restrictions.h" |
22 #include "build/build_config.h" | 23 #include "build/build_config.h" |
23 #include "chrome/app/chrome_command_ids.h" | 24 #include "chrome/app/chrome_command_ids.h" |
24 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
25 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
26 #include "chrome/browser/profiles/profile_attributes_entry.h" | 27 #include "chrome/browser/profiles/profile_attributes_entry.h" |
27 #include "chrome/browser/profiles/profile_attributes_storage.h" | 28 #include "chrome/browser/profiles/profile_attributes_storage.h" |
28 #include "chrome/browser/profiles/profile_window.h" | 29 #include "chrome/browser/profiles/profile_window.h" |
29 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" | 30 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" |
30 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" | 31 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" |
31 #include "chrome/browser/search_engines/template_url_service_factory.h" | 32 #include "chrome/browser/search_engines/template_url_service_factory.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 params.writing_direction_right_to_left = 0; | 108 params.writing_direction_right_to_left = 0; |
108 #endif // OS_MACOSX | 109 #endif // OS_MACOSX |
109 std::unique_ptr<TestRenderViewContextMenu> menu( | 110 std::unique_ptr<TestRenderViewContextMenu> menu( |
110 new TestRenderViewContextMenu(web_contents->GetMainFrame(), params)); | 111 new TestRenderViewContextMenu(web_contents->GetMainFrame(), params)); |
111 menu->Init(); | 112 menu->Init(); |
112 return menu; | 113 return menu; |
113 } | 114 } |
114 | 115 |
115 // Does not work on ChromeOS. | 116 // Does not work on ChromeOS. |
116 Profile* CreateSecondaryProfile(int profile_num) { | 117 Profile* CreateSecondaryProfile(int profile_num) { |
| 118 base::ThreadRestrictions::ScopedAllowIO allow_io; |
117 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 119 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
118 base::FilePath profile_path = profile_manager->user_data_dir(); | 120 base::FilePath profile_path = profile_manager->user_data_dir(); |
119 profile_path = profile_path.AppendASCII( | 121 profile_path = profile_path.AppendASCII( |
120 base::StringPrintf("New Profile %d", profile_num)); | 122 base::StringPrintf("New Profile %d", profile_num)); |
121 return profile_manager->GetProfile(profile_path); | 123 return profile_manager->GetProfile(profile_path); |
122 } | 124 } |
123 }; | 125 }; |
124 | 126 |
125 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, | 127 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, |
126 OpenEntryPresentForNormalURLs) { | 128 OpenEntryPresentForNormalURLs) { |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { | 791 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { |
790 static const char kValidImage[] = "/load_image/image.png"; | 792 static const char kValidImage[] = "/load_image/image.png"; |
791 SetupAndLoadImagePage(kValidImage); | 793 SetupAndLoadImagePage(kValidImage); |
792 AddLoadImageInterceptor(kValidImage); | 794 AddLoadImageInterceptor(kValidImage); |
793 AttemptLoadImage(); | 795 AttemptLoadImage(); |
794 interceptor_->WaitForRequests(1); | 796 interceptor_->WaitForRequests(1); |
795 EXPECT_EQ(1, interceptor_->num_requests()); | 797 EXPECT_EQ(1, interceptor_->num_requests()); |
796 } | 798 } |
797 | 799 |
798 } // namespace | 800 } // namespace |
OLD | NEW |