| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_tabstrip.h" | 8 #include "chrome/browser/ui/browser_tabstrip.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
| 11 #include "content/public/browser/invalidate_type.h" | 11 #include "content/public/browser/invalidate_type.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
| 14 | 14 |
| 15 typedef InProcessBrowserTest BrowserViewTest; | 15 typedef InProcessBrowserTest BrowserViewTest; |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // Used to simulate scenario in a crash. When WebContentsDestroyed() is invoked | 19 // Used to simulate scenario in a crash. When WebContentsDestroyed() is invoked |
| 20 // updates the navigation state of another tab. | 20 // updates the navigation state of another tab. |
| 21 class TestWebContentsObserver : public content::WebContentsObserver { | 21 class TestWebContentsObserver : public content::WebContentsObserver { |
| 22 public: | 22 public: |
| 23 TestWebContentsObserver(content::WebContents* source, | 23 TestWebContentsObserver(content::WebContents* source, |
| 24 content::WebContents* other) | 24 content::WebContents* other) |
| 25 : content::WebContentsObserver(source), | 25 : content::WebContentsObserver(source), |
| 26 other_(other) {} | 26 other_(other) {} |
| 27 virtual ~TestWebContentsObserver() {} | 27 virtual ~TestWebContentsObserver() {} |
| 28 | 28 |
| 29 virtual void WebContentsDestroyed( | 29 virtual void WebContentsDestroyed() OVERRIDE { |
| 30 content::WebContents* web_contents) OVERRIDE { | |
| 31 other_->NotifyNavigationStateChanged( | 30 other_->NotifyNavigationStateChanged( |
| 32 content::INVALIDATE_TYPE_URL | content::INVALIDATE_TYPE_LOAD); | 31 content::INVALIDATE_TYPE_URL | content::INVALIDATE_TYPE_LOAD); |
| 33 } | 32 } |
| 34 | 33 |
| 35 private: | 34 private: |
| 36 content::WebContents* other_; | 35 content::WebContents* other_; |
| 37 | 36 |
| 38 DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver); | 37 DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver); |
| 39 }; | 38 }; |
| 40 | 39 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 62 new Browser(Browser::CreateParams(browser()->profile(), | 61 new Browser(Browser::CreateParams(browser()->profile(), |
| 63 browser()->host_desktop_type())); | 62 browser()->host_desktop_type())); |
| 64 chrome::AddTabAt(browser2, GURL(), -1, true); | 63 chrome::AddTabAt(browser2, GURL(), -1, true); |
| 65 chrome::AddTabAt(browser2, GURL(), -1, true); | 64 chrome::AddTabAt(browser2, GURL(), -1, true); |
| 66 browser2->tab_strip_model()->ActivateTabAt(0, true); | 65 browser2->tab_strip_model()->ActivateTabAt(0, true); |
| 67 TestWebContentsObserver observer( | 66 TestWebContentsObserver observer( |
| 68 browser2->tab_strip_model()->GetWebContentsAt(0), | 67 browser2->tab_strip_model()->GetWebContentsAt(0), |
| 69 browser2->tab_strip_model()->GetWebContentsAt(1)); | 68 browser2->tab_strip_model()->GetWebContentsAt(1)); |
| 70 BrowserView::GetBrowserViewForBrowser(browser2)->GetWidget()->CloseNow(); | 69 BrowserView::GetBrowserViewForBrowser(browser2)->GetWidget()->CloseNow(); |
| 71 } | 70 } |
| OLD | NEW |