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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 1381003004: Better distinguish didFinishLoad and didStopLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix WebFrameTest.CallbackOrdering race Created 5 years, 2 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 8238 matching lines...) Expand 10 before | Expand all | Expand 10 after
8249 8249
8250 EXPECT_TRUE(resource); 8250 EXPECT_TRUE(resource);
8251 EXPECT_NE(0, resource->loadFinishTime()); 8251 EXPECT_NE(0, resource->loadFinishTime());
8252 8252
8253 DocumentLoader* loader = document->loader(); 8253 DocumentLoader* loader = document->loader();
8254 8254
8255 EXPECT_TRUE(loader); 8255 EXPECT_TRUE(loader);
8256 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime()); 8256 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime());
8257 } 8257 }
8258 8258
8259 class CallbackOrderingWebFrameClient : public FrameTestHelpers::TestWebFrameClie nt {
8260 public:
8261 CallbackOrderingWebFrameClient() : m_callbackCount(0) { }
8262
8263 void didStartLoading(bool toDifferentDocument) override
8264 {
8265 EXPECT_EQ(0, m_callbackCount++);
8266 FrameTestHelpers::TestWebFrameClient::didStartLoading(toDifferentDocumen t);
8267 }
8268 void didStartProvisionalLoad(WebLocalFrame*, double) override { EXPECT_EQ(1, m_callbackCount++); }
8269 void didCommitProvisionalLoad(WebLocalFrame*, const WebHistoryItem&, WebHist oryCommitType) override { EXPECT_EQ(2, m_callbackCount++); }
8270 void didFinishDocumentLoad(WebLocalFrame*, bool documentIsEmpty) override { EXPECT_EQ(3, m_callbackCount++); }
8271 void didHandleOnloadEvents(WebLocalFrame*) override { EXPECT_EQ(4, m_callbac kCount++); }
8272 void didFinishLoad(WebLocalFrame*) override { EXPECT_EQ(5, m_callbackCount++ ); }
8273 void didStopLoading() override
8274 {
8275 EXPECT_EQ(6, m_callbackCount++);
8276 FrameTestHelpers::TestWebFrameClient::didStopLoading();
8277 }
8278
8279 private:
8280 int m_callbackCount;
8281 };
8282
8283 TEST_F(WebFrameTest, CallbackOrdering)
8284 {
8285 registerMockedHttpURLLoad("foo.html");
8286 FrameTestHelpers::WebViewHelper webViewHelper;
8287 CallbackOrderingWebFrameClient client;
8288 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true, &client);
8289 }
8290
8259 } // namespace blink 8291 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698