OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/activity/public/activity.h" | 5 #include "athena/activity/public/activity.h" |
6 #include "athena/test/chrome/athena_browsertest.h" | 6 #include "athena/test/chrome/athena_browsertest.h" |
7 #include "athena/test/chrome/test_util.h" | 7 #include "athena/test/chrome/test_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/tab_helper.h" | 9 #include "chrome/browser/extensions/tab_helper.h" |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const content::NotificationSource& source, | 43 const content::NotificationSource& source, |
44 const content::NotificationDetails& details) override { | 44 const content::NotificationDetails& details) override { |
45 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, | 45 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, |
46 type); | 46 type); |
47 | 47 |
48 // Assume that all of the WebActivity helpers were created if the | 48 // Assume that all of the WebActivity helpers were created if the |
49 // extensions::TabHelper was created. | 49 // extensions::TabHelper was created. |
50 content::WebContents* web_contents = | 50 content::WebContents* web_contents = |
51 content::Source<content::WebContents>(source).ptr(); | 51 content::Source<content::WebContents>(source).ptr(); |
52 helpers_created_prior_to_render_view_ &= | 52 helpers_created_prior_to_render_view_ &= |
53 (extensions::TabHelper::FromWebContents(web_contents) != NULL); | 53 (extensions::TabHelper::FromWebContents(web_contents) != nullptr); |
54 } | 54 } |
55 | 55 |
56 bool helpers_created_prior_to_render_view_; | 56 bool helpers_created_prior_to_render_view_; |
57 content::NotificationRegistrar registrar_; | 57 content::NotificationRegistrar registrar_; |
58 | 58 |
59 DISALLOW_COPY_AND_ASSIGN(HelpersCreatedChecker); | 59 DISALLOW_COPY_AND_ASSIGN(HelpersCreatedChecker); |
60 }; | 60 }; |
61 | 61 |
62 typedef AthenaBrowserTest WebActivityHelpersBrowserTest; | 62 typedef AthenaBrowserTest WebActivityHelpersBrowserTest; |
63 | 63 |
(...skipping 19 matching lines...) Expand all Loading... |
83 activity->SetCurrentState(Activity::ACTIVITY_UNLOADED); | 83 activity->SetCurrentState(Activity::ACTIVITY_UNLOADED); |
84 activity->SetCurrentState(Activity::ACTIVITY_VISIBLE); | 84 activity->SetCurrentState(Activity::ACTIVITY_VISIBLE); |
85 | 85 |
86 content::WebContents* web_contents2 = activity->GetWebContents(); | 86 content::WebContents* web_contents2 = activity->GetWebContents(); |
87 EXPECT_NE(web_contents1, web_contents2); | 87 EXPECT_NE(web_contents1, web_contents2); |
88 EXPECT_TRUE(web_contents2->GetRenderViewHost()->IsRenderViewLive()); | 88 EXPECT_TRUE(web_contents2->GetRenderViewHost()->IsRenderViewLive()); |
89 EXPECT_TRUE(checker.HelpersCreatedPriorToRenderView()); | 89 EXPECT_TRUE(checker.HelpersCreatedPriorToRenderView()); |
90 } | 90 } |
91 | 91 |
92 } // namespace athena | 92 } // namespace athena |
OLD | NEW |