Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: content/shell/test_runner/web_frame_test_client.cc

Issue 2714943004: Move unique name generation and tracking into //content. (Closed)
Patch Set: Rebase again. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/shell/test_runner/layout_dump.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/shell/test_runner/web_frame_test_client.h" 5 #include "content/shell/test_runner/web_frame_test_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "content/public/test/test_runner_support.h"
13 #include "content/shell/test_runner/accessibility_controller.h" 14 #include "content/shell/test_runner/accessibility_controller.h"
14 #include "content/shell/test_runner/event_sender.h" 15 #include "content/shell/test_runner/event_sender.h"
15 #include "content/shell/test_runner/mock_color_chooser.h" 16 #include "content/shell/test_runner/mock_color_chooser.h"
16 #include "content/shell/test_runner/mock_screen_orientation_client.h" 17 #include "content/shell/test_runner/mock_screen_orientation_client.h"
17 #include "content/shell/test_runner/mock_web_user_media_client.h" 18 #include "content/shell/test_runner/mock_web_user_media_client.h"
18 #include "content/shell/test_runner/test_common.h" 19 #include "content/shell/test_runner/test_common.h"
19 #include "content/shell/test_runner/test_interfaces.h" 20 #include "content/shell/test_runner/test_interfaces.h"
20 #include "content/shell/test_runner/test_plugin.h" 21 #include "content/shell/test_runner/test_plugin.h"
21 #include "content/shell/test_runner/test_runner.h" 22 #include "content/shell/test_runner/test_runner.h"
22 #include "content/shell/test_runner/web_frame_test_proxy.h" 23 #include "content/shell/test_runner/web_frame_test_proxy.h"
(...skipping 14 matching lines...) Expand all
37 #include "third_party/WebKit/public/web/WebPluginParams.h" 38 #include "third_party/WebKit/public/web/WebPluginParams.h"
38 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 39 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
39 #include "third_party/WebKit/public/web/WebView.h" 40 #include "third_party/WebKit/public/web/WebView.h"
40 #include "url/gurl.h" 41 #include "url/gurl.h"
41 #include "url/url_constants.h" 42 #include "url/url_constants.h"
42 43
43 namespace test_runner { 44 namespace test_runner {
44 45
45 namespace { 46 namespace {
46 47
47 void PrintFrameDescription(WebTestDelegate* delegate, blink::WebFrame* frame) { 48 void PrintFrameDescription(WebTestDelegate* delegate,
48 std::string name8 = frame->uniqueName().utf8(); 49 blink::WebLocalFrame* frame) {
50 std::string name = content::GetUniqueNameForFrame(frame);
49 if (frame == frame->view()->mainFrame()) { 51 if (frame == frame->view()->mainFrame()) {
50 if (!name8.length()) { 52 DCHECK(name.empty());
51 delegate->PrintMessage("main frame"); 53 delegate->PrintMessage("main frame");
52 return;
53 }
54 delegate->PrintMessage(std::string("main frame \"") + name8 + "\"");
55 return; 54 return;
56 } 55 }
57 if (!name8.length()) { 56 if (name.empty()) {
58 delegate->PrintMessage("frame (anonymous)"); 57 delegate->PrintMessage("frame (anonymous)");
59 return; 58 return;
60 } 59 }
61 delegate->PrintMessage(std::string("frame \"") + name8 + "\""); 60 delegate->PrintMessage(std::string("frame \"") + name + "\"");
62 } 61 }
63 62
64 void PrintFrameuserGestureStatus(WebTestDelegate* delegate, 63 void PrintFrameuserGestureStatus(WebTestDelegate* delegate,
65 blink::WebFrame* frame, 64 blink::WebFrame* frame,
66 const char* msg) { 65 const char* msg) {
67 bool is_user_gesture = 66 bool is_user_gesture =
68 blink::WebUserGestureIndicator::isProcessingUserGesture(); 67 blink::WebUserGestureIndicator::isProcessingUserGesture();
69 delegate->PrintMessage(std::string("Frame with user gesture \"") + 68 delegate->PrintMessage(std::string("Frame with user gesture \"") +
70 (is_user_gesture ? "true" : "false") + "\"" + msg); 69 (is_user_gesture ? "true" : "false") + "\"" + msg);
71 } 70 }
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 blink::WebEffectiveConnectionType 744 blink::WebEffectiveConnectionType
746 WebFrameTestClient::getEffectiveConnectionType() { 745 WebFrameTestClient::getEffectiveConnectionType() {
747 return test_runner()->effective_connection_type(); 746 return test_runner()->effective_connection_type();
748 } 747 }
749 748
750 TestRunner* WebFrameTestClient::test_runner() { 749 TestRunner* WebFrameTestClient::test_runner() {
751 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); 750 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner();
752 } 751 }
753 752
754 } // namespace test_runner 753 } // namespace test_runner
OLDNEW
« no previous file with comments | « content/shell/test_runner/layout_dump.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698