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

Side by Side Diff: components/web_view/frame_apptest.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 11 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 | « components/web_view/frame.cc ('k') | components/web_view/frame_connection.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/web_view/frame.h" 5 #include "components/web_view/frame.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/location.h" 11 #include "base/location.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 15 #include "base/run_loop.h"
15 #include "base/test/test_timeouts.h" 16 #include "base/test/test_timeouts.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "components/mus/public/cpp/window_observer.h" 19 #include "components/mus/public/cpp/window_observer.h"
19 #include "components/mus/public/cpp/window_tree_connection.h" 20 #include "components/mus/public/cpp/window_tree_connection.h"
20 #include "components/mus/public/cpp/window_tree_delegate.h" 21 #include "components/mus/public/cpp/window_tree_delegate.h"
21 #include "components/mus/public/cpp/window_tree_host_factory.h" 22 #include "components/mus/public/cpp/window_tree_host_factory.h"
22 #include "components/mus/public/interfaces/window_tree_host.mojom.h" 23 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
23 #include "components/web_view/frame.h"
24 #include "components/web_view/frame_connection.h" 24 #include "components/web_view/frame_connection.h"
25 #include "components/web_view/frame_tree.h" 25 #include "components/web_view/frame_tree.h"
26 #include "components/web_view/frame_tree_delegate.h" 26 #include "components/web_view/frame_tree_delegate.h"
27 #include "components/web_view/frame_user_data.h" 27 #include "components/web_view/frame_user_data.h"
28 #include "components/web_view/test_frame_tree_delegate.h" 28 #include "components/web_view/test_frame_tree_delegate.h"
29 #include "mojo/application/public/cpp/application_connection.h" 29 #include "mojo/application/public/cpp/application_connection.h"
30 #include "mojo/application/public/cpp/application_delegate.h" 30 #include "mojo/application/public/cpp/application_delegate.h"
31 #include "mojo/application/public/cpp/application_impl.h" 31 #include "mojo/application/public/cpp/application_impl.h"
32 #include "mojo/application/public/cpp/application_test_base.h" 32 #include "mojo/application/public/cpp/application_test_base.h"
33 #include "mojo/application/public/cpp/service_provider_impl.h" 33 #include "mojo/application/public/cpp/service_provider_impl.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 run_loop->Quit(); 74 run_loop->Quit();
75 } 75 }
76 76
77 // Creates a new FrameConnection. This runs a nested message loop until the 77 // Creates a new FrameConnection. This runs a nested message loop until the
78 // content handler id is obtained. 78 // content handler id is obtained.
79 scoped_ptr<FrameConnection> CreateFrameConnection(mojo::ApplicationImpl* app) { 79 scoped_ptr<FrameConnection> CreateFrameConnection(mojo::ApplicationImpl* app) {
80 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); 80 scoped_ptr<FrameConnection> frame_connection(new FrameConnection);
81 mojo::URLRequestPtr request(mojo::URLRequest::New()); 81 mojo::URLRequestPtr request(mojo::URLRequest::New());
82 request->url = mojo::String::From(app->url()); 82 request->url = mojo::String::From(app->url());
83 base::RunLoop run_loop; 83 base::RunLoop run_loop;
84 frame_connection->Init(app, request.Pass(), 84 frame_connection->Init(app, std::move(request),
85 base::Bind(&OnGotIdCallback, &run_loop)); 85 base::Bind(&OnGotIdCallback, &run_loop));
86 run_loop.Run(); 86 run_loop.Run();
87 return frame_connection; 87 return frame_connection;
88 } 88 }
89 89
90 class TestFrameClient : public mojom::FrameClient { 90 class TestFrameClient : public mojom::FrameClient {
91 public: 91 public:
92 TestFrameClient() 92 TestFrameClient()
93 : connect_count_(0), last_dispatch_load_event_frame_id_(0) {} 93 : connect_count_(0), last_dispatch_load_event_frame_id_(0) {}
94 ~TestFrameClient() override {} 94 ~TestFrameClient() override {}
95 95
96 int connect_count() const { return connect_count_; } 96 int connect_count() const { return connect_count_; }
97 97
98 mojo::Array<mojom::FrameDataPtr> connect_frames() { 98 mojo::Array<mojom::FrameDataPtr> connect_frames() {
99 return connect_frames_.Pass(); 99 return std::move(connect_frames_);
100 } 100 }
101 101
102 mojo::Array<mojom::FrameDataPtr> adds() { return adds_.Pass(); } 102 mojo::Array<mojom::FrameDataPtr> adds() { return std::move(adds_); }
103 103
104 // Sets a callback to run once OnConnect() is received. 104 // Sets a callback to run once OnConnect() is received.
105 void set_on_connect_callback(const base::Closure& closure) { 105 void set_on_connect_callback(const base::Closure& closure) {
106 on_connect_callback_ = closure; 106 on_connect_callback_ = closure;
107 } 107 }
108 108
109 void set_on_loading_state_changed_callback(const base::Closure& closure) { 109 void set_on_loading_state_changed_callback(const base::Closure& closure) {
110 on_loading_state_changed_callback_ = closure; 110 on_loading_state_changed_callback_ = closure;
111 } 111 }
112 112
(...skipping 23 matching lines...) Expand all
136 136
137 // mojom::FrameClient: 137 // mojom::FrameClient:
138 void OnConnect(mojom::FramePtr frame, 138 void OnConnect(mojom::FramePtr frame,
139 uint32_t change_id, 139 uint32_t change_id,
140 uint32_t window_id, 140 uint32_t window_id,
141 mojom::WindowConnectType window_connect_type, 141 mojom::WindowConnectType window_connect_type,
142 mojo::Array<mojom::FrameDataPtr> frames, 142 mojo::Array<mojom::FrameDataPtr> frames,
143 int64_t navigation_start_time_ticks, 143 int64_t navigation_start_time_ticks,
144 const OnConnectCallback& callback) override { 144 const OnConnectCallback& callback) override {
145 connect_count_++; 145 connect_count_++;
146 connect_frames_ = frames.Pass(); 146 connect_frames_ = std::move(frames);
147 if (frame) 147 if (frame)
148 server_frame_ = frame.Pass(); 148 server_frame_ = std::move(frame);
149 callback.Run(); 149 callback.Run();
150 if (!on_connect_callback_.is_null()) 150 if (!on_connect_callback_.is_null())
151 on_connect_callback_.Run(); 151 on_connect_callback_.Run();
152 152
153 last_navigation_start_time_ = 153 last_navigation_start_time_ =
154 base::TimeTicks::FromInternalValue(navigation_start_time_ticks); 154 base::TimeTicks::FromInternalValue(navigation_start_time_ticks);
155 } 155 }
156 void OnFrameAdded(uint32_t change_id, mojom::FrameDataPtr frame) override { 156 void OnFrameAdded(uint32_t change_id, mojom::FrameDataPtr frame) override {
157 adds_.push_back(frame.Pass()); 157 adds_.push_back(std::move(frame));
158 } 158 }
159 void OnFrameRemoved(uint32_t change_id, uint32_t frame_id) override {} 159 void OnFrameRemoved(uint32_t change_id, uint32_t frame_id) override {}
160 void OnFrameClientPropertyChanged(uint32_t frame_id, 160 void OnFrameClientPropertyChanged(uint32_t frame_id,
161 const mojo::String& name, 161 const mojo::String& name,
162 mojo::Array<uint8_t> new_data) override {} 162 mojo::Array<uint8_t> new_data) override {}
163 void OnPostMessageEvent(uint32_t source_frame_id, 163 void OnPostMessageEvent(uint32_t source_frame_id,
164 uint32_t target_frame_id, 164 uint32_t target_frame_id,
165 mojom::HTMLMessageEventPtr event) override {} 165 mojom::HTMLMessageEventPtr event) override {}
166 void OnWillNavigate(const mojo::String& origin, 166 void OnWillNavigate(const mojo::String& origin,
167 const OnWillNavigateCallback& callback) override { 167 const OnWillNavigateCallback& callback) override {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // Runs a message loop until the window and frame data have been received. 246 // Runs a message loop until the window and frame data have been received.
247 void WaitForViewAndFrame() { run_loop_.Run(); } 247 void WaitForViewAndFrame() { run_loop_.Run(); }
248 248
249 mojo::InterfaceRequest<mojom::Frame> GetServerFrameRequest() { 249 mojo::InterfaceRequest<mojom::Frame> GetServerFrameRequest() {
250 return test_frame_tree_client_.GetServerFrameRequest(); 250 return test_frame_tree_client_.GetServerFrameRequest();
251 } 251 }
252 252
253 mojom::FrameClientPtr GetFrameClientPtr() { 253 mojom::FrameClientPtr GetFrameClientPtr() {
254 mojom::FrameClientPtr client_ptr; 254 mojom::FrameClientPtr client_ptr;
255 frame_client_binding_.Bind(GetProxy(&client_ptr)); 255 frame_client_binding_.Bind(GetProxy(&client_ptr));
256 return client_ptr.Pass(); 256 return client_ptr;
257 } 257 }
258 258
259 void Bind(mojo::InterfaceRequest<mojom::FrameClient> request) { 259 void Bind(mojo::InterfaceRequest<mojom::FrameClient> request) {
260 ASSERT_FALSE(frame_client_binding_.is_bound()); 260 ASSERT_FALSE(frame_client_binding_.is_bound());
261 test_frame_tree_client_.set_on_connect_callback( 261 test_frame_tree_client_.set_on_connect_callback(
262 base::Bind(&WindowAndFrame::OnGotConnect, base::Unretained(this))); 262 base::Bind(&WindowAndFrame::OnGotConnect, base::Unretained(this)));
263 frame_client_binding_.Bind(request.Pass()); 263 frame_client_binding_.Bind(std::move(request));
264 } 264 }
265 265
266 void OnGotConnect() { QuitRunLoopIfNecessary(); } 266 void OnGotConnect() { QuitRunLoopIfNecessary(); }
267 267
268 void QuitRunLoopIfNecessary() { 268 void QuitRunLoopIfNecessary() {
269 if (window_ && test_frame_tree_client_.connect_count()) 269 if (window_ && test_frame_tree_client_.connect_count())
270 run_loop_.Quit(); 270 run_loop_.Quit();
271 } 271 }
272 272
273 // Overridden from WindowTreeDelegate: 273 // Overridden from WindowTreeDelegate:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 310 }
311 311
312 scoped_ptr<WindowAndFrame> NavigateFrameWithStartTime( 312 scoped_ptr<WindowAndFrame> NavigateFrameWithStartTime(
313 WindowAndFrame* window_and_frame, 313 WindowAndFrame* window_and_frame,
314 base::TimeTicks navigation_start_time) { 314 base::TimeTicks navigation_start_time) {
315 mojo::URLRequestPtr request(mojo::URLRequest::New()); 315 mojo::URLRequestPtr request(mojo::URLRequest::New());
316 request->url = mojo::String::From(application_impl()->url()); 316 request->url = mojo::String::From(application_impl()->url());
317 request->originating_time_ticks = navigation_start_time.ToInternalValue(); 317 request->originating_time_ticks = navigation_start_time.ToInternalValue();
318 window_and_frame->server_frame()->RequestNavigate( 318 window_and_frame->server_frame()->RequestNavigate(
319 mojom::NAVIGATION_TARGET_TYPE_EXISTING_FRAME, 319 mojom::NAVIGATION_TARGET_TYPE_EXISTING_FRAME,
320 window_and_frame->window()->id(), request.Pass()); 320 window_and_frame->window()->id(), std::move(request));
321 return WaitForViewAndFrame(); 321 return WaitForViewAndFrame();
322 } 322 }
323 323
324 scoped_ptr<WindowAndFrame> NavigateFrame(WindowAndFrame* window_and_frame) { 324 scoped_ptr<WindowAndFrame> NavigateFrame(WindowAndFrame* window_and_frame) {
325 return NavigateFrameWithStartTime(window_and_frame, base::TimeTicks()); 325 return NavigateFrameWithStartTime(window_and_frame, base::TimeTicks());
326 } 326 }
327 327
328 // Creates a new shared frame as a child of |parent|. 328 // Creates a new shared frame as a child of |parent|.
329 scoped_ptr<WindowAndFrame> CreateChildWindowAndFrame(WindowAndFrame* parent) { 329 scoped_ptr<WindowAndFrame> CreateChildWindowAndFrame(WindowAndFrame* parent) {
330 mus::Window* child_frame_window = 330 mus::Window* child_frame_window =
331 parent->window()->connection()->NewWindow(); 331 parent->window()->connection()->NewWindow();
332 parent->window()->AddChild(child_frame_window); 332 parent->window()->AddChild(child_frame_window);
333 333
334 scoped_ptr<WindowAndFrame> window_and_frame(new WindowAndFrame); 334 scoped_ptr<WindowAndFrame> window_and_frame(new WindowAndFrame);
335 window_and_frame->set_window(child_frame_window); 335 window_and_frame->set_window(child_frame_window);
336 336
337 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties; 337 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties;
338 client_properties.mark_non_null(); 338 client_properties.mark_non_null();
339 parent->server_frame()->OnCreatedFrame( 339 parent->server_frame()->OnCreatedFrame(
340 window_and_frame->GetServerFrameRequest(), 340 window_and_frame->GetServerFrameRequest(),
341 window_and_frame->GetFrameClientPtr(), child_frame_window->id(), 341 window_and_frame->GetFrameClientPtr(), child_frame_window->id(),
342 client_properties.Pass()); 342 std::move(client_properties));
343 frame_tree_delegate()->WaitForCreateFrame(); 343 frame_tree_delegate()->WaitForCreateFrame();
344 return HasFatalFailure() ? nullptr : window_and_frame.Pass(); 344 return HasFatalFailure() ? nullptr : std::move(window_and_frame);
345 } 345 }
346 346
347 // Runs a message loop until the data necessary to represent to a client side 347 // Runs a message loop until the data necessary to represent to a client side
348 // frame has been obtained. 348 // frame has been obtained.
349 scoped_ptr<WindowAndFrame> WaitForViewAndFrame() { 349 scoped_ptr<WindowAndFrame> WaitForViewAndFrame() {
350 DCHECK(!window_and_frame_); 350 DCHECK(!window_and_frame_);
351 window_and_frame_.reset(new WindowAndFrame); 351 window_and_frame_.reset(new WindowAndFrame);
352 window_and_frame_->WaitForViewAndFrame(); 352 window_and_frame_->WaitForViewAndFrame();
353 return window_and_frame_.Pass(); 353 return std::move(window_and_frame_);
354 } 354 }
355 355
356 private: 356 private:
357 // ApplicationTestBase: 357 // ApplicationTestBase:
358 ApplicationDelegate* GetApplicationDelegate() override { return this; } 358 ApplicationDelegate* GetApplicationDelegate() override { return this; }
359 359
360 // ApplicationDelegate implementation. 360 // ApplicationDelegate implementation.
361 bool ConfigureIncomingConnection( 361 bool ConfigureIncomingConnection(
362 mojo::ApplicationConnection* connection) override { 362 mojo::ApplicationConnection* connection) override {
363 connection->AddService<mus::mojom::WindowTreeClient>(this); 363 connection->AddService<mus::mojom::WindowTreeClient>(this);
(...skipping 23 matching lines...) Expand all
387 // FrameClient to be connected to. 387 // FrameClient to be connected to.
388 frame_tree_delegate_.reset(new TestFrameTreeDelegate(application_impl())); 388 frame_tree_delegate_.reset(new TestFrameTreeDelegate(application_impl()));
389 scoped_ptr<FrameConnection> frame_connection = 389 scoped_ptr<FrameConnection> frame_connection =
390 CreateFrameConnection(application_impl()); 390 CreateFrameConnection(application_impl());
391 mojom::FrameClient* frame_client = frame_connection->frame_client(); 391 mojom::FrameClient* frame_client = frame_connection->frame_client();
392 mus::mojom::WindowTreeClientPtr window_tree_client = 392 mus::mojom::WindowTreeClientPtr window_tree_client =
393 frame_connection->GetWindowTreeClient(); 393 frame_connection->GetWindowTreeClient();
394 mus::Window* frame_root_view = window_manager()->NewWindow(); 394 mus::Window* frame_root_view = window_manager()->NewWindow();
395 window_manager()->GetRoot()->AddChild(frame_root_view); 395 window_manager()->GetRoot()->AddChild(frame_root_view);
396 frame_tree_.reset(new FrameTree( 396 frame_tree_.reset(new FrameTree(
397 0u, frame_root_view, window_tree_client.Pass(), 397 0u, frame_root_view, std::move(window_tree_client),
398 frame_tree_delegate_.get(), frame_client, frame_connection.Pass(), 398 frame_tree_delegate_.get(), frame_client, std::move(frame_connection),
399 Frame::ClientPropertyMap(), base::TimeTicks::Now())); 399 Frame::ClientPropertyMap(), base::TimeTicks::Now()));
400 root_window_and_frame_ = WaitForViewAndFrame(); 400 root_window_and_frame_ = WaitForViewAndFrame();
401 } 401 }
402 402
403 // Overridden from testing::Test: 403 // Overridden from testing::Test:
404 void TearDown() override { 404 void TearDown() override {
405 root_window_and_frame_.reset(); 405 root_window_and_frame_.reset();
406 frame_tree_.reset(); 406 frame_tree_.reset();
407 frame_tree_delegate_.reset(); 407 frame_tree_delegate_.reset();
408 ApplicationTestBase::TearDown(); 408 ApplicationTestBase::TearDown();
409 } 409 }
410 410
411 // Overridden from mojo::InterfaceFactory<mus::mojom::WindowTreeClient>: 411 // Overridden from mojo::InterfaceFactory<mus::mojom::WindowTreeClient>:
412 void Create( 412 void Create(
413 mojo::ApplicationConnection* connection, 413 mojo::ApplicationConnection* connection,
414 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override { 414 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override {
415 if (window_and_frame_) { 415 if (window_and_frame_) {
416 mus::WindowTreeConnection::Create( 416 mus::WindowTreeConnection::Create(
417 window_and_frame_.get(), request.Pass(), 417 window_and_frame_.get(), std::move(request),
418 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); 418 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED);
419 } else { 419 } else {
420 mus::WindowTreeConnection::Create( 420 mus::WindowTreeConnection::Create(
421 this, request.Pass(), 421 this, std::move(request),
422 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); 422 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED);
423 } 423 }
424 } 424 }
425 425
426 // Overridden from mojo::InterfaceFactory<mojom::FrameClient>: 426 // Overridden from mojo::InterfaceFactory<mojom::FrameClient>:
427 void Create(mojo::ApplicationConnection* connection, 427 void Create(mojo::ApplicationConnection* connection,
428 mojo::InterfaceRequest<mojom::FrameClient> request) override { 428 mojo::InterfaceRequest<mojom::FrameClient> request) override {
429 ASSERT_TRUE(window_and_frame_); 429 ASSERT_TRUE(window_and_frame_);
430 window_and_frame_->Bind(request.Pass()); 430 window_and_frame_->Bind(std::move(request));
431 } 431 }
432 432
433 scoped_ptr<TestFrameTreeDelegate> frame_tree_delegate_; 433 scoped_ptr<TestFrameTreeDelegate> frame_tree_delegate_;
434 scoped_ptr<FrameTree> frame_tree_; 434 scoped_ptr<FrameTree> frame_tree_;
435 scoped_ptr<WindowAndFrame> root_window_and_frame_; 435 scoped_ptr<WindowAndFrame> root_window_and_frame_;
436 436
437 mus::mojom::WindowTreeHostPtr host_; 437 mus::mojom::WindowTreeHostPtr host_;
438 438
439 // Used to receive the most recent window manager loaded by an embed action. 439 // Used to receive the most recent window manager loaded by an embed action.
440 WindowTreeConnection* most_recent_connection_; 440 WindowTreeConnection* most_recent_connection_;
(...skipping 24 matching lines...) Expand all
465 #define MAYBE_ChildFrameClientConnectData ChildFrameClientConnectData 465 #define MAYBE_ChildFrameClientConnectData ChildFrameClientConnectData
466 #endif 466 #endif
467 TEST_F(FrameTest, MAYBE_ChildFrameClientConnectData) { 467 TEST_F(FrameTest, MAYBE_ChildFrameClientConnectData) {
468 scoped_ptr<WindowAndFrame> child_view_and_frame( 468 scoped_ptr<WindowAndFrame> child_view_and_frame(
469 CreateChildWindowAndFrame(root_window_and_frame())); 469 CreateChildWindowAndFrame(root_window_and_frame()));
470 ASSERT_TRUE(child_view_and_frame); 470 ASSERT_TRUE(child_view_and_frame);
471 // Initially created child frames don't get OnConnect(). 471 // Initially created child frames don't get OnConnect().
472 EXPECT_EQ(0, child_view_and_frame->test_frame_client()->connect_count()); 472 EXPECT_EQ(0, child_view_and_frame->test_frame_client()->connect_count());
473 473
474 scoped_ptr<WindowAndFrame> navigated_child_view_and_frame = 474 scoped_ptr<WindowAndFrame> navigated_child_view_and_frame =
475 NavigateFrame(child_view_and_frame.get()).Pass(); 475 NavigateFrame(child_view_and_frame.get());
476 476
477 mojo::Array<mojom::FrameDataPtr> frames_in_child = 477 mojo::Array<mojom::FrameDataPtr> frames_in_child =
478 navigated_child_view_and_frame->test_frame_client()->connect_frames(); 478 navigated_child_view_and_frame->test_frame_client()->connect_frames();
479 EXPECT_EQ(child_view_and_frame->window()->id(), 479 EXPECT_EQ(child_view_and_frame->window()->id(),
480 navigated_child_view_and_frame->window()->id()); 480 navigated_child_view_and_frame->window()->id());
481 // We expect 2 frames. One for the root, one for the child. 481 // We expect 2 frames. One for the root, one for the child.
482 ASSERT_EQ(2u, frames_in_child.size()); 482 ASSERT_EQ(2u, frames_in_child.size());
483 EXPECT_EQ(frame_tree()->root()->id(), frames_in_child[0]->frame_id); 483 EXPECT_EQ(frame_tree()->root()->id(), frames_in_child[0]->frame_id);
484 EXPECT_EQ(0u, frames_in_child[0]->parent_id); 484 EXPECT_EQ(0u, frames_in_child[0]->parent_id);
485 EXPECT_EQ(navigated_child_view_and_frame->window()->id(), 485 EXPECT_EQ(navigated_child_view_and_frame->window()->id(),
486 frames_in_child[1]->frame_id); 486 frames_in_child[1]->frame_id);
487 EXPECT_EQ(frame_tree()->root()->id(), frames_in_child[1]->parent_id); 487 EXPECT_EQ(frame_tree()->root()->id(), frames_in_child[1]->parent_id);
488 } 488 }
489 489
490 TEST_F(FrameTest, OnViewEmbeddedInFrameDisconnected) { 490 TEST_F(FrameTest, OnViewEmbeddedInFrameDisconnected) {
491 scoped_ptr<WindowAndFrame> child_view_and_frame( 491 scoped_ptr<WindowAndFrame> child_view_and_frame(
492 CreateChildWindowAndFrame(root_window_and_frame())); 492 CreateChildWindowAndFrame(root_window_and_frame()));
493 ASSERT_TRUE(child_view_and_frame); 493 ASSERT_TRUE(child_view_and_frame);
494 494
495 scoped_ptr<WindowAndFrame> navigated_child_view_and_frame = 495 scoped_ptr<WindowAndFrame> navigated_child_view_and_frame =
496 NavigateFrame(child_view_and_frame.get()).Pass(); 496 NavigateFrame(child_view_and_frame.get());
497 497
498 // Delete the WindowTreeConnection for the child, which should trigger 498 // Delete the WindowTreeConnection for the child, which should trigger
499 // notification. 499 // notification.
500 delete navigated_child_view_and_frame->window()->connection(); 500 delete navigated_child_view_and_frame->window()->connection();
501 ASSERT_EQ(1u, frame_tree()->root()->children().size()); 501 ASSERT_EQ(1u, frame_tree()->root()->children().size());
502 ASSERT_NO_FATAL_FAILURE(frame_tree_delegate()->WaitForFrameDisconnected( 502 ASSERT_NO_FATAL_FAILURE(frame_tree_delegate()->WaitForFrameDisconnected(
503 frame_tree()->root()->children()[0])); 503 frame_tree()->root()->children()[0]));
504 ASSERT_EQ(1u, frame_tree()->root()->children().size()); 504 ASSERT_EQ(1u, frame_tree()->root()->children().size());
505 } 505 }
506 506
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 } 571 }
572 572
573 TEST_F(FrameTest, PassAlongNavigationStartTime) { 573 TEST_F(FrameTest, PassAlongNavigationStartTime) {
574 scoped_ptr<WindowAndFrame> child_view_and_frame( 574 scoped_ptr<WindowAndFrame> child_view_and_frame(
575 CreateChildWindowAndFrame(root_window_and_frame())); 575 CreateChildWindowAndFrame(root_window_and_frame()));
576 ASSERT_TRUE(child_view_and_frame); 576 ASSERT_TRUE(child_view_and_frame);
577 577
578 base::TimeTicks navigation_start_time = base::TimeTicks::FromInternalValue(1); 578 base::TimeTicks navigation_start_time = base::TimeTicks::FromInternalValue(1);
579 scoped_ptr<WindowAndFrame> navigated_child_view_and_frame = 579 scoped_ptr<WindowAndFrame> navigated_child_view_and_frame =
580 NavigateFrameWithStartTime(child_view_and_frame.get(), 580 NavigateFrameWithStartTime(child_view_and_frame.get(),
581 navigation_start_time) 581 navigation_start_time);
582 .Pass();
583 EXPECT_EQ(navigation_start_time, 582 EXPECT_EQ(navigation_start_time,
584 navigated_child_view_and_frame->test_frame_client() 583 navigated_child_view_and_frame->test_frame_client()
585 ->last_navigation_start_time()); 584 ->last_navigation_start_time());
586 } 585 }
587 586
588 } // namespace web_view 587 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/frame.cc ('k') | components/web_view/frame_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698