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

Side by Side Diff: chrome/test/remoting/page_load_notification_observer.cc

Issue 771003002: Add support for deferring app initialization when testing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/test/remoting/page_load_notification_observer.h" 5 #include "chrome/test/remoting/page_load_notification_observer.h"
6 6
7 #include "content/public/browser/navigation_controller.h" 7 #include "content/public/browser/navigation_controller.h"
8 #include "content/public/browser/notification_types.h" 8 #include "content/public/browser/notification_types.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 10
11 namespace remoting { 11 namespace remoting {
12 12
13 PageLoadNotificationObserver::PageLoadNotificationObserver(const GURL& target) 13 PageLoadNotificationObserver::PageLoadNotificationObserver(const GURL& target)
14 : WindowedNotificationObserver( 14 : WindowedNotificationObserver(
15 content::NOTIFICATION_LOAD_STOP, 15 content::NOTIFICATION_LOAD_STOP,
16 base::Bind(&PageLoadNotificationObserver::IsTargetLoaded, 16 base::Bind(&PageLoadNotificationObserver::IsTargetLoaded,
17 base::Unretained(this))), 17 base::Unretained(this))),
18 target_(target) { 18 target_(target),
19 ignore_url_parameters_(false) {
19 } 20 }
20 21
21 PageLoadNotificationObserver::~PageLoadNotificationObserver() {} 22 PageLoadNotificationObserver::~PageLoadNotificationObserver() {}
22 23
23 bool PageLoadNotificationObserver::IsTargetLoaded() { 24 bool PageLoadNotificationObserver::IsTargetLoaded() {
24 content::NavigationController* controller = 25 content::NavigationController* controller =
25 content::Source<content::NavigationController>(source()).ptr(); 26 content::Source<content::NavigationController>(source()).ptr();
26 return controller->GetWebContents()->GetURL() == target_; 27 GURL current_url = controller->GetWebContents()->GetURL();
28 if (ignore_url_parameters_) {
29 GURL::Replacements strip_query;
30 strip_query.ClearQuery();
31 return current_url.ReplaceComponents(strip_query) ==
32 target_.ReplaceComponents(strip_query);
33 } else {
34 return current_url == target_;
35 }
27 } 36 }
28 37
29 } // namespace remoting 38 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698