OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
7 #include "base/metrics/histogram_base.h" | 7 #include "base/metrics/histogram_base.h" |
8 #include "base/metrics/histogram_samples.h" | 8 #include "base/metrics/histogram_samples.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 const content::RenderProcessHost* start_rph = | 284 const content::RenderProcessHost* start_rph = |
285 contents->GetRenderProcessHost(); | 285 contents->GetRenderProcessHost(); |
286 const content::RenderViewHost* start_rvh = | 286 const content::RenderViewHost* start_rvh = |
287 contents->GetRenderViewHost(); | 287 contents->GetRenderViewHost(); |
288 | 288 |
289 // Navigate to end URL via a renderer-initiated navigation. | 289 // Navigate to end URL via a renderer-initiated navigation. |
290 content::NavigationController* controller = &contents->GetController(); | 290 content::NavigationController* controller = &contents->GetController(); |
291 content::NavigationController::LoadURLParams load_params( | 291 content::NavigationController::LoadURLParams load_params( |
292 GURL(test.end_url)); | 292 GURL(test.end_url)); |
293 load_params.is_renderer_initiated = true; | 293 load_params.is_renderer_initiated = true; |
294 load_params.transition_type = content::PAGE_TRANSITION_LINK; | 294 load_params.transition_type = ui::PAGE_TRANSITION_LINK; |
295 | 295 |
296 controller->LoadURLWithParams(load_params); | 296 controller->LoadURLWithParams(load_params); |
297 CommitPendingLoad(controller); | 297 CommitPendingLoad(controller); |
298 EXPECT_EQ(test.end_in_instant_process, InInstantProcess(contents)) | 298 EXPECT_EQ(test.end_in_instant_process, InInstantProcess(contents)) |
299 << test.description; | 299 << test.description; |
300 | 300 |
301 EXPECT_EQ(test.same_site_instance, | 301 EXPECT_EQ(test.same_site_instance, |
302 start_site_instance.get() == contents->GetSiteInstance()) | 302 start_site_instance.get() == contents->GetSiteInstance()) |
303 << test.description; | 303 << test.description; |
304 EXPECT_EQ(test.same_site_instance, | 304 EXPECT_EQ(test.same_site_instance, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 AddTab(browser(), GURL("chrome://blank")); | 349 AddTab(browser(), GURL("chrome://blank")); |
350 for (size_t i = 0; i < arraysize(kInstantNTPTestCases); ++i) { | 350 for (size_t i = 0; i < arraysize(kInstantNTPTestCases); ++i) { |
351 const SearchTestCase& test = kInstantNTPTestCases[i]; | 351 const SearchTestCase& test = kInstantNTPTestCases[i]; |
352 NavigateAndCommitActiveTab(GURL(test.url)); | 352 NavigateAndCommitActiveTab(GURL(test.url)); |
353 content::WebContents* contents = | 353 content::WebContents* contents = |
354 browser()->tab_strip_model()->GetWebContentsAt(0); | 354 browser()->tab_strip_model()->GetWebContentsAt(0); |
355 content::NavigationController& controller = contents->GetController(); | 355 content::NavigationController& controller = contents->GetController(); |
356 controller.SetTransientEntry( | 356 controller.SetTransientEntry( |
357 controller.CreateNavigationEntry(GURL("chrome://blank"), | 357 controller.CreateNavigationEntry(GURL("chrome://blank"), |
358 content::Referrer(), | 358 content::Referrer(), |
359 content::PAGE_TRANSITION_LINK, | 359 ui::PAGE_TRANSITION_LINK, |
360 false, | 360 false, |
361 std::string(), | 361 std::string(), |
362 contents->GetBrowserContext())); | 362 contents->GetBrowserContext())); |
363 // The active entry is chrome://blank and not an NTP. | 363 // The active entry is chrome://blank and not an NTP. |
364 EXPECT_FALSE(IsInstantNTP(contents)); | 364 EXPECT_FALSE(IsInstantNTP(contents)); |
365 EXPECT_EQ(test.expected_result, | 365 EXPECT_EQ(test.expected_result, |
366 NavEntryIsInstantNTP(contents, | 366 NavEntryIsInstantNTP(contents, |
367 controller.GetLastCommittedEntry())) | 367 controller.GetLastCommittedEntry())) |
368 << test.url << " " << test.comment; | 368 << test.url << " " << test.comment; |
369 } | 369 } |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 } | 1000 } |
1001 | 1001 |
1002 TEST_F(OriginChipTest, CommandLineOnSrp) { | 1002 TEST_F(OriginChipTest, CommandLineOnSrp) { |
1003 CommandLine::ForCurrentProcess()->AppendSwitch( | 1003 CommandLine::ForCurrentProcess()->AppendSwitch( |
1004 switches::kEnableOriginChipOnSrp); | 1004 switches::kEnableOriginChipOnSrp); |
1005 EXPECT_TRUE(ShouldDisplayOriginChip()); | 1005 EXPECT_TRUE(ShouldDisplayOriginChip()); |
1006 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); | 1006 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); |
1007 } | 1007 } |
1008 | 1008 |
1009 } // namespace chrome | 1009 } // namespace chrome |
OLD | NEW |