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

Side by Side Diff: chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc

Issue 2345053006: Remove IsSynchronous API from NavigationHandle. (Closed)
Patch Set: Addressed review comments. 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 | « no previous file | chrome/browser/extensions/api/web_navigation/web_navigation_api.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 (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 "chrome/browser/captive_portal/captive_portal_tab_helper.h" 5 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 13 matching lines...) Expand all
24 #include "content/public/test/web_contents_tester.h" 24 #include "content/public/test/web_contents_tester.h"
25 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
26 #include "testing/gmock/include/gmock/gmock.h" 26 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
28 28
29 using captive_portal::CaptivePortalResult; 29 using captive_portal::CaptivePortalResult;
30 using content::ResourceType; 30 using content::ResourceType;
31 31
32 namespace { 32 namespace {
33 33
34 const char* const kStartUrl = "http://whatever.com/index.html";
34 const char* const kHttpUrl = "http://whatever.com/"; 35 const char* const kHttpUrl = "http://whatever.com/";
35 const char* const kHttpsUrl = "https://whatever.com/"; 36 const char* const kHttpsUrl = "https://whatever.com/";
36 37
37 // Used for cross-process navigations. Shouldn't actually matter whether this 38 // Used for cross-process navigations. Shouldn't actually matter whether this
38 // is different from kHttpsUrl, but best to keep things consistent. 39 // is different from kHttpsUrl, but best to keep things consistent.
39 const char* const kHttpsUrl2 = "https://cross_process.com/"; 40 const char* const kHttpsUrl2 = "https://cross_process.com/";
40 41
41 // Some navigations behave differently depending on if they're cross-process 42 // Some navigations behave differently depending on if they're cross-process
42 // or not. 43 // or not.
43 enum NavigationType { 44 enum NavigationType {
(...skipping 23 matching lines...) Expand all
67 // the harness in any other way. 68 // the harness in any other way.
68 class CaptivePortalTabHelperTest : public ChromeRenderViewHostTestHarness { 69 class CaptivePortalTabHelperTest : public ChromeRenderViewHostTestHarness {
69 public: 70 public:
70 CaptivePortalTabHelperTest() 71 CaptivePortalTabHelperTest()
71 : mock_reloader_(new testing::StrictMock<MockCaptivePortalTabReloader>) {} 72 : mock_reloader_(new testing::StrictMock<MockCaptivePortalTabReloader>) {}
72 ~CaptivePortalTabHelperTest() override {} 73 ~CaptivePortalTabHelperTest() override {}
73 74
74 void SetUp() override { 75 void SetUp() override {
75 ChromeRenderViewHostTestHarness::SetUp(); 76 ChromeRenderViewHostTestHarness::SetUp();
76 77
77 // Load kHttpUrl. This ensures that any subsequent navigation to kHttpsUrl2 78 // Load kStartUrl. This ensures that any subsequent navigation to kHttpsUrl2
78 // will be properly registered as cross-process. 79 // will be properly registered as cross-process. It should be different than
80 // the rest of the URLs used, otherwise unit tests will clasify navigations
81 // as same document ones, which would be incorrect.
79 content::WebContentsTester* web_contents_tester = 82 content::WebContentsTester* web_contents_tester =
80 content::WebContentsTester::For(web_contents()); 83 content::WebContentsTester::For(web_contents());
81 web_contents_tester->NavigateAndCommit(GURL(kHttpUrl)); 84 web_contents_tester->NavigateAndCommit(GURL(kStartUrl));
82 content::RenderFrameHostTester* rfh_tester = 85 content::RenderFrameHostTester* rfh_tester =
83 content::RenderFrameHostTester::For(main_rfh()); 86 content::RenderFrameHostTester::For(main_rfh());
84 rfh_tester->SimulateNavigationStop(); 87 rfh_tester->SimulateNavigationStop();
85 88
86 tab_helper_.reset(new CaptivePortalTabHelper(web_contents())); 89 tab_helper_.reset(new CaptivePortalTabHelper(web_contents()));
87 tab_helper_->profile_ = nullptr; 90 tab_helper_->profile_ = nullptr;
88 tab_helper_->SetTabReloaderForTest(mock_reloader_); 91 tab_helper_->SetTabReloaderForTest(mock_reloader_);
89 } 92 }
90 93
91 void TearDown() override { 94 void TearDown() override {
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 EXPECT_FALSE(tab_helper()->IsLoginTab()); 527 EXPECT_FALSE(tab_helper()->IsLoginTab());
525 528
526 ObservePortalResult(captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL, 529 ObservePortalResult(captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL,
527 captive_portal::RESULT_NO_RESPONSE); 530 captive_portal::RESULT_NO_RESPONSE);
528 EXPECT_FALSE(tab_helper()->IsLoginTab()); 531 EXPECT_FALSE(tab_helper()->IsLoginTab());
529 532
530 ObservePortalResult(captive_portal::RESULT_NO_RESPONSE, 533 ObservePortalResult(captive_portal::RESULT_NO_RESPONSE,
531 captive_portal::RESULT_INTERNET_CONNECTED); 534 captive_portal::RESULT_INTERNET_CONNECTED);
532 EXPECT_FALSE(tab_helper()->IsLoginTab()); 535 EXPECT_FALSE(tab_helper()->IsLoginTab());
533 } 536 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/web_navigation/web_navigation_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698