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

Side by Side Diff: content/browser/site_instance_impl_unittest.cc

Issue 2437253002: Improve TDI render process naming in the task manager. (Closed)
Patch Set: ncarter Created 4 years, 1 month 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 | « content/browser/site_instance_impl.cc ('k') | content/public/browser/site_instance.h » ('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 (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 "content/browser/site_instance_impl.h" 5 #include "content/browser/site_instance_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 806
807 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); 807 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext());
808 scoped_refptr<SiteInstanceImpl> main_instance = 808 scoped_refptr<SiteInstanceImpl> main_instance =
809 SiteInstanceImpl::Create(browser_context.get()); 809 SiteInstanceImpl::Create(browser_context.get());
810 scoped_refptr<SiteInstanceImpl> subframe_instance = 810 scoped_refptr<SiteInstanceImpl> subframe_instance =
811 main_instance->GetDefaultSubframeSiteInstance(); 811 main_instance->GetDefaultSubframeSiteInstance();
812 int subframe_instance_id = subframe_instance->GetId(); 812 int subframe_instance_id = subframe_instance->GetId();
813 813
814 EXPECT_NE(main_instance, subframe_instance); 814 EXPECT_NE(main_instance, subframe_instance);
815 EXPECT_EQ(subframe_instance, main_instance->GetDefaultSubframeSiteInstance()); 815 EXPECT_EQ(subframe_instance, main_instance->GetDefaultSubframeSiteInstance());
816 EXPECT_FALSE(main_instance->is_default_subframe_site_instance()); 816 EXPECT_FALSE(main_instance->IsDefaultSubframeSiteInstance());
817 EXPECT_TRUE(subframe_instance->is_default_subframe_site_instance()); 817 EXPECT_TRUE(subframe_instance->IsDefaultSubframeSiteInstance());
818 818
819 EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount()); 819 EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount());
820 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); 820 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount());
821 821
822 // Free the subframe instance. 822 // Free the subframe instance.
823 subframe_instance = nullptr; 823 subframe_instance = nullptr;
824 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); 824 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount());
825 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); 825 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount());
826 826
827 // Calling GetDefaultSubframeSiteInstance again should return a new 827 // Calling GetDefaultSubframeSiteInstance again should return a new
828 // SiteInstance with a different ID from the original. 828 // SiteInstance with a different ID from the original.
829 subframe_instance = main_instance->GetDefaultSubframeSiteInstance(); 829 subframe_instance = main_instance->GetDefaultSubframeSiteInstance();
830 EXPECT_NE(subframe_instance->GetId(), subframe_instance_id); 830 EXPECT_NE(subframe_instance->GetId(), subframe_instance_id);
831 EXPECT_FALSE(main_instance->is_default_subframe_site_instance()); 831 EXPECT_FALSE(main_instance->IsDefaultSubframeSiteInstance());
832 EXPECT_TRUE(subframe_instance->is_default_subframe_site_instance()); 832 EXPECT_TRUE(subframe_instance->IsDefaultSubframeSiteInstance());
833 EXPECT_EQ(subframe_instance->GetDefaultSubframeSiteInstance(), 833 EXPECT_EQ(subframe_instance->GetDefaultSubframeSiteInstance(),
834 subframe_instance); 834 subframe_instance);
835 EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount()); 835 EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount());
836 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); 836 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount());
837 837
838 // Free the main instance. 838 // Free the main instance.
839 main_instance = nullptr; 839 main_instance = nullptr;
840 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); 840 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount());
841 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); 841 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount());
842 842
843 // Free the subframe instance, which should free the browsing instance. 843 // Free the subframe instance, which should free the browsing instance.
844 subframe_instance = nullptr; 844 subframe_instance = nullptr;
845 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); 845 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount());
846 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); 846 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount());
847 } 847 }
848 848
849 } // namespace content 849 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_instance_impl.cc ('k') | content/public/browser/site_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698