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

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_api_unittest.cc

Issue 2297863003: Fix initialization for a few more unit_tests under PlzNavigate (Closed)
Patch Set: rebase Created 4 years, 3 months 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/extension_context_menu_model_unittest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/extensions/api/tabs/tabs_api.h" 6 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
7 #include "chrome/browser/extensions/extension_function_test_utils.h" 7 #include "chrome/browser/extensions/extension_function_test_utils.h"
8 #include "chrome/browser/extensions/extension_service_test_base.h" 8 #include "chrome/browser/extensions/extension_service_test_base.h"
9 #include "chrome/browser/extensions/extension_tab_util.h" 9 #include "chrome/browser/extensions/extension_tab_util.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/test/base/test_browser_window.h" 12 #include "chrome/test/base/test_browser_window.h"
13 #include "content/public/browser/navigation_entry.h" 13 #include "content/public/browser/navigation_entry.h"
14 #include "content/public/common/browser_side_navigation_policy.h"
15 #include "content/public/test/browser_side_navigation_test_utils.h"
14 #include "content/public/test/web_contents_tester.h" 16 #include "content/public/test/web_contents_tester.h"
15 #include "extensions/common/extension_builder.h" 17 #include "extensions/common/extension_builder.h"
16 #include "extensions/common/test_util.h" 18 #include "extensions/common/test_util.h"
17 19
18 namespace extensions { 20 namespace extensions {
19 21
20 namespace { 22 namespace {
21 23
22 std::unique_ptr<base::ListValue> RunTabsQueryFunction( 24 std::unique_ptr<base::ListValue> RunTabsQueryFunction(
23 Browser* browser, 25 Browser* browser,
(...skipping 26 matching lines...) Expand all
50 std::unique_ptr<TestBrowserWindow> browser_window_; 52 std::unique_ptr<TestBrowserWindow> browser_window_;
51 std::unique_ptr<Browser> browser_; 53 std::unique_ptr<Browser> browser_;
52 54
53 DISALLOW_COPY_AND_ASSIGN(TabsApiUnitTest); 55 DISALLOW_COPY_AND_ASSIGN(TabsApiUnitTest);
54 }; 56 };
55 57
56 void TabsApiUnitTest::SetUp() { 58 void TabsApiUnitTest::SetUp() {
57 ExtensionServiceTestBase::SetUp(); 59 ExtensionServiceTestBase::SetUp();
58 InitializeEmptyExtensionService(); 60 InitializeEmptyExtensionService();
59 61
62 if (content::IsBrowserSideNavigationEnabled())
63 content::BrowserSideNavigationSetUp();
64
60 browser_window_.reset(new TestBrowserWindow()); 65 browser_window_.reset(new TestBrowserWindow());
61 Browser::CreateParams params(profile()); 66 Browser::CreateParams params(profile());
62 params.type = Browser::TYPE_TABBED; 67 params.type = Browser::TYPE_TABBED;
63 params.window = browser_window_.get(); 68 params.window = browser_window_.get();
64 browser_.reset(new Browser(params)); 69 browser_.reset(new Browser(params));
65 } 70 }
66 71
67 void TabsApiUnitTest::TearDown() { 72 void TabsApiUnitTest::TearDown() {
68 browser_.reset(); 73 browser_.reset();
69 browser_window_.reset(); 74 browser_window_.reset();
75 if (content::IsBrowserSideNavigationEnabled())
76 content::BrowserSideNavigationTearDown();
70 ExtensionServiceTestBase::TearDown(); 77 ExtensionServiceTestBase::TearDown();
71 } 78 }
72 79
73 TEST_F(TabsApiUnitTest, QueryWithoutTabsPermission) { 80 TEST_F(TabsApiUnitTest, QueryWithoutTabsPermission) {
74 GURL tab_urls[] = {GURL("http://www.google.com"), 81 GURL tab_urls[] = {GURL("http://www.google.com"),
75 GURL("http://www.example.com"), 82 GURL("http://www.example.com"),
76 GURL("https://www.google.com")}; 83 GURL("https://www.google.com")};
77 std::string tab_titles[] = {"", "Sample title", "Sample title"}; 84 std::string tab_titles[] = {"", "Sample title", "Sample title"};
78 85
79 // Add 3 web contentses to the browser. 86 // Add 3 web contentses to the browser.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 ASSERT_TRUE(first_tab_info->GetInteger("id", &first_tab_id)); 210 ASSERT_TRUE(first_tab_info->GetInteger("id", &first_tab_id));
204 EXPECT_TRUE(base::ContainsValue(expected_tabs_ids, first_tab_id)); 211 EXPECT_TRUE(base::ContainsValue(expected_tabs_ids, first_tab_id));
205 212
206 int third_tab_id = -1; 213 int third_tab_id = -1;
207 ASSERT_TRUE(third_tab_info->GetInteger("id", &third_tab_id)); 214 ASSERT_TRUE(third_tab_info->GetInteger("id", &third_tab_id));
208 EXPECT_TRUE(base::ContainsValue(expected_tabs_ids, third_tab_id)); 215 EXPECT_TRUE(base::ContainsValue(expected_tabs_ids, third_tab_id));
209 } 216 }
210 } 217 }
211 218
212 } // namespace extensions 219 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_context_menu_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698