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

Side by Side Diff: chrome/browser/ui/tabs/tab_strip_model_unittest.cc

Issue 14241002: Move the parsing of app.launch related keys out of Extension class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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
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/ui/tabs/tab_strip_model.h" 5 #include "chrome/browser/ui/tabs/tab_strip_model.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_split.h" 17 #include "base/strings/string_split.h"
18 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
19 #include "chrome/browser/defaults.h" 19 #include "chrome/browser/defaults.h"
20 #include "chrome/browser/extensions/tab_helper.h" 20 #include "chrome/browser/extensions/tab_helper.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_tabstrip.h" 23 #include "chrome/browser/ui/browser_tabstrip.h"
24 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" 24 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
25 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h" 25 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h"
26 #include "chrome/browser/ui/tabs/test_tab_strip_model_delegate.h" 26 #include "chrome/browser/ui/tabs/test_tab_strip_model_delegate.h"
27 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 27 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
28 #include "chrome/common/chrome_notification_types.h" 28 #include "chrome/common/chrome_notification_types.h"
29 #include "chrome/common/extensions/app_launcher_info.h"
29 #include "chrome/common/extensions/extension.h" 30 #include "chrome/common/extensions/extension.h"
31 #include "chrome/common/extensions/manifest_handler.h"
30 #include "chrome/common/url_constants.h" 32 #include "chrome/common/url_constants.h"
31 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 33 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
32 #include "chrome/test/base/testing_profile.h" 34 #include "chrome/test/base/testing_profile.h"
33 #include "content/public/browser/navigation_controller.h" 35 #include "content/public/browser/navigation_controller.h"
34 #include "content/public/browser/navigation_entry.h" 36 #include "content/public/browser/navigation_entry.h"
35 #include "content/public/browser/notification_details.h" 37 #include "content/public/browser/notification_details.h"
36 #include "content/public/browser/notification_registrar.h" 38 #include "content/public/browser/notification_registrar.h"
37 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
38 #include "content/public/browser/render_process_host.h" 40 #include "content/public/browser/render_process_host.h"
39 #include "content/public/browser/web_contents.h" 41 #include "content/public/browser/web_contents.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 int id_; 107 int id_;
106 }; 108 };
107 109
108 } // namespace 110 } // namespace
109 111
110 class TabStripModelTest : public ChromeRenderViewHostTestHarness { 112 class TabStripModelTest : public ChromeRenderViewHostTestHarness {
111 public: 113 public:
112 TabStripModelTest() : browser_thread_(BrowserThread::UI, &message_loop_) { 114 TabStripModelTest() : browser_thread_(BrowserThread::UI, &message_loop_) {
113 } 115 }
114 116
117 virtual void SetUp() OVERRIDE {
118 ChromeRenderViewHostTestHarness::SetUp();
119 (new extensions::AppLaunchManifestHandler)->Register();
120 }
121
122 virtual void TearDown() OVERRIDE {
123 extensions::ManifestHandler::ClearRegistryForTesting();
124 ChromeRenderViewHostTestHarness::TearDown();
125 }
126
115 WebContents* CreateWebContents() { 127 WebContents* CreateWebContents() {
116 return WebContents::Create(WebContents::CreateParams(profile())); 128 return WebContents::Create(WebContents::CreateParams(profile()));
117 } 129 }
118 130
119 WebContents* CreateWebContentsWithSharedRPH(WebContents* web_contents) { 131 WebContents* CreateWebContentsWithSharedRPH(WebContents* web_contents) {
120 WebContents::CreateParams create_params( 132 WebContents::CreateParams create_params(
121 profile(), web_contents->GetRenderViewHost()->GetSiteInstance()); 133 profile(), web_contents->GetRenderViewHost()->GetSiteInstance());
122 WebContents* retval = WebContents::Create(create_params); 134 WebContents* retval = WebContents::Create(create_params);
123 EXPECT_EQ(retval->GetRenderProcessHost(), 135 EXPECT_EQ(retval->GetRenderProcessHost(),
124 web_contents->GetRenderProcessHost()); 136 web_contents->GetRenderProcessHost());
(...skipping 2209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 strip.ActivateTabAt(1, true); 2346 strip.ActivateTabAt(1, true);
2335 ASSERT_EQ(1, observer.GetStateCount()); 2347 ASSERT_EQ(1, observer.GetStateCount());
2336 State s(contents2, 1, MockTabStripModelObserver::SELECT); 2348 State s(contents2, 1, MockTabStripModelObserver::SELECT);
2337 s.src_contents = contents2; 2349 s.src_contents = contents2;
2338 s.src_index = 1; 2350 s.src_index = 1;
2339 s.change_reason = TabStripModelObserver::CHANGE_REASON_NONE; 2351 s.change_reason = TabStripModelObserver::CHANGE_REASON_NONE;
2340 EXPECT_TRUE(observer.StateEquals(0, s)); 2352 EXPECT_TRUE(observer.StateEquals(0, s));
2341 strip.RemoveObserver(&observer); 2353 strip.RemoveObserver(&observer);
2342 strip.CloseAllTabs(); 2354 strip.CloseAllTabs();
2343 } 2355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698