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

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: . 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
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/renderer/render_frame_impl.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 const std::string& name =
51 content::RenderFrameImpl::FromWebFrame(frame)->unique_name();
49 if (frame == frame->view()->mainFrame()) { 52 if (frame == frame->view()->mainFrame()) {
50 if (!name8.length()) { 53 DCHECK(name.empty());
51 delegate->PrintMessage("main frame"); 54 delegate->PrintMessage("main frame");
52 return;
53 }
54 delegate->PrintMessage(std::string("main frame \"") + name8 + "\"");
55 return; 55 return;
56 } 56 }
57 if (!name8.length()) { 57 if (name.empty()) {
58 delegate->PrintMessage("frame (anonymous)"); 58 delegate->PrintMessage("frame (anonymous)");
59 return; 59 return;
60 } 60 }
61 delegate->PrintMessage(std::string("frame \"") + name8 + "\""); 61 delegate->PrintMessage(std::string("frame \"") + name + "\"");
62 } 62 }
63 63
64 void PrintFrameuserGestureStatus(WebTestDelegate* delegate, 64 void PrintFrameuserGestureStatus(WebTestDelegate* delegate,
65 blink::WebFrame* frame, 65 blink::WebFrame* frame,
66 const char* msg) { 66 const char* msg) {
67 bool is_user_gesture = 67 bool is_user_gesture =
68 blink::WebUserGestureIndicator::isProcessingUserGesture(); 68 blink::WebUserGestureIndicator::isProcessingUserGesture();
69 delegate->PrintMessage(std::string("Frame with user gesture \"") + 69 delegate->PrintMessage(std::string("Frame with user gesture \"") +
70 (is_user_gesture ? "true" : "false") + "\"" + msg); 70 (is_user_gesture ? "true" : "false") + "\"" + msg);
71 } 71 }
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 blink::WebEffectiveConnectionType 733 blink::WebEffectiveConnectionType
734 WebFrameTestClient::getEffectiveConnectionType() { 734 WebFrameTestClient::getEffectiveConnectionType() {
735 return test_runner()->effective_connection_type(); 735 return test_runner()->effective_connection_type();
736 } 736 }
737 737
738 TestRunner* WebFrameTestClient::test_runner() { 738 TestRunner* WebFrameTestClient::test_runner() {
739 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); 739 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner();
740 } 740 }
741 741
742 } // namespace test_runner 742 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698