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

Side by Side Diff: chrome/browser/extensions/extension_browsertests_misc.cc

Issue 8892011: Clean up TCW, make it solely a hub for 1:1 observer/helper objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/autoupdate_interceptor.h" 8 #include "chrome/browser/extensions/autoupdate_interceptor.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/extension_browsertest.h" 10 #include "chrome/browser/extensions/extension_browsertest.h"
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 EXPECT_EQ(size_before + 1, service->extensions()->size()); 798 EXPECT_EQ(size_before + 1, service->extensions()->size());
799 // Now the plugin should be in the cache, but we have to reload the page for 799 // Now the plugin should be in the cache, but we have to reload the page for
800 // it to work. 800 // it to work.
801 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 801 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
802 tab->render_view_host(), L"", L"testPluginWorks()", &result)); 802 tab->render_view_host(), L"", L"testPluginWorks()", &result));
803 EXPECT_FALSE(result); 803 EXPECT_FALSE(result);
804 { 804 {
805 ui_test_utils::WindowedNotificationObserver observer( 805 ui_test_utils::WindowedNotificationObserver observer(
806 content::NOTIFICATION_LOAD_STOP, 806 content::NOTIFICATION_LOAD_STOP,
807 content::Source<NavigationController>( 807 content::Source<NavigationController>(
808 &browser()->GetSelectedTabContentsWrapper()->controller())); 808 &browser()->GetSelectedTabContentsWrapper()->tab_contents()->
809 controller()));
809 browser()->Reload(CURRENT_TAB); 810 browser()->Reload(CURRENT_TAB);
810 observer.Wait(); 811 observer.Wait();
811 } 812 }
812 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 813 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
813 tab->render_view_host(), L"", L"testPluginWorks()", &result)); 814 tab->render_view_host(), L"", L"testPluginWorks()", &result));
814 EXPECT_TRUE(result); 815 EXPECT_TRUE(result);
815 816
816 EXPECT_EQ(size_before + 1, service->extensions()->size()); 817 EXPECT_EQ(size_before + 1, service->extensions()->size());
817 UnloadExtension(extension->id()); 818 UnloadExtension(extension->id());
818 EXPECT_EQ(size_before, service->extensions()->size()); 819 EXPECT_EQ(size_before, service->extensions()->size());
819 820
820 // Now the plugin should be unloaded, and the page should be broken. 821 // Now the plugin should be unloaded, and the page should be broken.
821 822
822 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 823 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
823 tab->render_view_host(), L"", L"testPluginWorks()", &result)); 824 tab->render_view_host(), L"", L"testPluginWorks()", &result));
824 EXPECT_FALSE(result); 825 EXPECT_FALSE(result);
825 826
826 // If we reload the extension and page, it should work again. 827 // If we reload the extension and page, it should work again.
827 828
828 ASSERT_TRUE(LoadExtension(extension_dir)); 829 ASSERT_TRUE(LoadExtension(extension_dir));
829 EXPECT_EQ(size_before + 1, service->extensions()->size()); 830 EXPECT_EQ(size_before + 1, service->extensions()->size());
830 { 831 {
831 ui_test_utils::WindowedNotificationObserver observer( 832 ui_test_utils::WindowedNotificationObserver observer(
832 content::NOTIFICATION_LOAD_STOP, 833 content::NOTIFICATION_LOAD_STOP,
833 content::Source<NavigationController>( 834 content::Source<NavigationController>(
834 &browser()->GetSelectedTabContentsWrapper()->controller())); 835 &browser()->GetSelectedTabContentsWrapper()->tab_contents()->
836 controller()));
835 browser()->Reload(CURRENT_TAB); 837 browser()->Reload(CURRENT_TAB);
836 observer.Wait(); 838 observer.Wait();
837 } 839 }
838 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 840 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
839 tab->render_view_host(), L"", L"testPluginWorks()", &result)); 841 tab->render_view_host(), L"", L"testPluginWorks()", &result));
840 EXPECT_TRUE(result); 842 EXPECT_TRUE(result);
841 } 843 }
842 844
843 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) 845 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
844 #define MAYBE_PluginPrivate PluginPrivate 846 #define MAYBE_PluginPrivate PluginPrivate
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 922
921 EXPECT_EQ(extension->GetResourceURL("options.html"), 923 EXPECT_EQ(extension->GetResourceURL("options.html"),
922 tab_strip->GetTabContentsAt(1)->tab_contents()->GetURL()); 924 tab_strip->GetTabContentsAt(1)->tab_contents()->GetURL());
923 } 925 }
924 926
925 //============================================================================== 927 //==============================================================================
926 // STOP! Please do not add any more random-ass tests here. Create new files for 928 // STOP! Please do not add any more random-ass tests here. Create new files for
927 // your tests grouped by functionality. Also, you should strongly consider using 929 // your tests grouped by functionality. Also, you should strongly consider using
928 // ExtensionAPITest if possible. 930 // ExtensionAPITest if possible.
929 //============================================================================== 931 //==============================================================================
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698