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

Side by Side Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 1159553007: Move Tuple to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 (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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 host_->SetView(view.get()); 808 host_->SetView(view.get());
809 809
810 EXPECT_TRUE(view->GetBackgroundOpaque()); 810 EXPECT_TRUE(view->GetBackgroundOpaque());
811 view->SetBackgroundColor(SK_ColorTRANSPARENT); 811 view->SetBackgroundColor(SK_ColorTRANSPARENT);
812 EXPECT_FALSE(view->GetBackgroundOpaque()); 812 EXPECT_FALSE(view->GetBackgroundOpaque());
813 813
814 const IPC::Message* set_background = 814 const IPC::Message* set_background =
815 process_->sink().GetUniqueMessageMatching( 815 process_->sink().GetUniqueMessageMatching(
816 ViewMsg_SetBackgroundOpaque::ID); 816 ViewMsg_SetBackgroundOpaque::ID);
817 ASSERT_TRUE(set_background); 817 ASSERT_TRUE(set_background);
818 Tuple<bool> sent_background; 818 base::Tuple<bool> sent_background;
819 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); 819 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background);
820 EXPECT_FALSE(get<0>(sent_background)); 820 EXPECT_FALSE(base::get<0>(sent_background));
821 821
822 #if defined(USE_AURA) 822 #if defined(USE_AURA)
823 // See the comment above |InitAsChild(NULL)|. 823 // See the comment above |InitAsChild(NULL)|.
824 host_->SetView(NULL); 824 host_->SetView(NULL);
825 static_cast<RenderWidgetHostViewBase*>(view.release())->Destroy(); 825 static_cast<RenderWidgetHostViewBase*>(view.release())->Destroy();
826 #endif 826 #endif
827 } 827 }
828 #endif 828 #endif
829 829
830 // Test that we don't paint when we're hidden, but we still send the ACK. Most 830 // Test that we don't paint when we're hidden, but we still send the ACK. Most
(...skipping 14 matching lines...) Expand all
845 845
846 // Now unhide. 846 // Now unhide.
847 process_->sink().ClearMessages(); 847 process_->sink().ClearMessages();
848 host_->WasShown(ui::LatencyInfo()); 848 host_->WasShown(ui::LatencyInfo());
849 EXPECT_FALSE(host_->is_hidden_); 849 EXPECT_FALSE(host_->is_hidden_);
850 850
851 // It should have sent out a restored message with a request to paint. 851 // It should have sent out a restored message with a request to paint.
852 const IPC::Message* restored = process_->sink().GetUniqueMessageMatching( 852 const IPC::Message* restored = process_->sink().GetUniqueMessageMatching(
853 ViewMsg_WasShown::ID); 853 ViewMsg_WasShown::ID);
854 ASSERT_TRUE(restored); 854 ASSERT_TRUE(restored);
855 Tuple<bool, ui::LatencyInfo> needs_repaint; 855 base::Tuple<bool, ui::LatencyInfo> needs_repaint;
856 ViewMsg_WasShown::Read(restored, &needs_repaint); 856 ViewMsg_WasShown::Read(restored, &needs_repaint);
857 EXPECT_TRUE(get<0>(needs_repaint)); 857 EXPECT_TRUE(base::get<0>(needs_repaint));
858 } 858 }
859 859
860 TEST_F(RenderWidgetHostTest, IgnoreKeyEventsHandledByRenderer) { 860 TEST_F(RenderWidgetHostTest, IgnoreKeyEventsHandledByRenderer) {
861 // Simulate a keyboard event. 861 // Simulate a keyboard event.
862 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); 862 SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
863 863
864 // Make sure we sent the input event to the renderer. 864 // Make sure we sent the input event to the renderer.
865 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( 865 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(
866 InputMsg_HandleInputEvent::ID)); 866 InputMsg_HandleInputEvent::ID));
867 process_->sink().ClearMessages(); 867 process_->sink().ClearMessages();
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 EXPECT_TRUE(host_->unresponsive_timer_fired()); 1087 EXPECT_TRUE(host_->unresponsive_timer_fired());
1088 } 1088 }
1089 1089
1090 std::string GetInputMessageTypes(RenderWidgetHostProcess* process) { 1090 std::string GetInputMessageTypes(RenderWidgetHostProcess* process) {
1091 std::string result; 1091 std::string result;
1092 for (size_t i = 0; i < process->sink().message_count(); ++i) { 1092 for (size_t i = 0; i < process->sink().message_count(); ++i) {
1093 const IPC::Message *message = process->sink().GetMessageAt(i); 1093 const IPC::Message *message = process->sink().GetMessageAt(i);
1094 EXPECT_EQ(InputMsg_HandleInputEvent::ID, message->type()); 1094 EXPECT_EQ(InputMsg_HandleInputEvent::ID, message->type());
1095 InputMsg_HandleInputEvent::Param params; 1095 InputMsg_HandleInputEvent::Param params;
1096 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(message, &params)); 1096 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(message, &params));
1097 const WebInputEvent* event = get<0>(params); 1097 const WebInputEvent* event = base::get<0>(params);
1098 if (i != 0) 1098 if (i != 0)
1099 result += " "; 1099 result += " ";
1100 result += WebInputEventTraits::GetName(event->type); 1100 result += WebInputEventTraits::GetName(event->type);
1101 } 1101 }
1102 process->sink().ClearMessages(); 1102 process->sink().ClearMessages();
1103 return result; 1103 return result;
1104 } 1104 }
1105 1105
1106 TEST_F(RenderWidgetHostTest, TouchEmulator) { 1106 TEST_F(RenderWidgetHostTest, TouchEmulator) {
1107 simulated_event_time_delta_seconds_ = 0.1; 1107 simulated_event_time_delta_seconds_ = 0.1;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 EXPECT_TRUE(host_->mock_input_router()->message_received_); 1413 EXPECT_TRUE(host_->mock_input_router()->message_received_);
1414 } 1414 }
1415 1415
1416 ui::LatencyInfo GetLatencyInfoFromInputEvent(RenderWidgetHostProcess* process) { 1416 ui::LatencyInfo GetLatencyInfoFromInputEvent(RenderWidgetHostProcess* process) {
1417 const IPC::Message* message = process->sink().GetUniqueMessageMatching( 1417 const IPC::Message* message = process->sink().GetUniqueMessageMatching(
1418 InputMsg_HandleInputEvent::ID); 1418 InputMsg_HandleInputEvent::ID);
1419 EXPECT_TRUE(message); 1419 EXPECT_TRUE(message);
1420 InputMsg_HandleInputEvent::Param params; 1420 InputMsg_HandleInputEvent::Param params;
1421 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(message, &params)); 1421 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(message, &params));
1422 process->sink().ClearMessages(); 1422 process->sink().ClearMessages();
1423 return get<1>(params); 1423 return base::get<1>(params);
1424 } 1424 }
1425 1425
1426 void CheckLatencyInfoComponentInMessage(RenderWidgetHostProcess* process, 1426 void CheckLatencyInfoComponentInMessage(RenderWidgetHostProcess* process,
1427 int64 component_id, 1427 int64 component_id,
1428 WebInputEvent::Type input_type) { 1428 WebInputEvent::Type input_type) {
1429 ui::LatencyInfo latency_info = GetLatencyInfoFromInputEvent(process); 1429 ui::LatencyInfo latency_info = GetLatencyInfoFromInputEvent(process);
1430 EXPECT_TRUE(latency_info.FindLatency( 1430 EXPECT_TRUE(latency_info.FindLatency(
1431 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1431 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
1432 component_id, 1432 component_id,
1433 NULL)); 1433 NULL));
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 // Having an initial size set means that the size information had been sent 1543 // Having an initial size set means that the size information had been sent
1544 // with the reqiest to new up the RenderView and so subsequent WasResized 1544 // with the reqiest to new up the RenderView and so subsequent WasResized
1545 // calls should not result in new IPC (unless the size has actually changed). 1545 // calls should not result in new IPC (unless the size has actually changed).
1546 host_->WasResized(); 1546 host_->WasResized();
1547 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); 1547 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID));
1548 EXPECT_EQ(initial_size_, host_->old_resize_params_->new_size); 1548 EXPECT_EQ(initial_size_, host_->old_resize_params_->new_size);
1549 EXPECT_TRUE(host_->resize_ack_pending_); 1549 EXPECT_TRUE(host_->resize_ack_pending_);
1550 } 1550 }
1551 1551
1552 } // namespace content 1552 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698